Re: Analize Java source file with perl?
- From: Jenda@xxxxxxxxxxx (Jenda Krynicky)
- Date: Sat, 28 Oct 2006 22:28:48 +0200
From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
Ovid schreef:
my $text = do { local $/; <$fh> };
There is a problem with this idiom: it uses about twice the memory of
this variant:
my $text ; { local $/ ; $text = <$fh> }
So if your files can be big (related to the amount of memory
available), use the latter.
How do you know? it doesn't seem to be the case. I tried to load a
2MB file both ways and the memory consumption seemed to be the same
(plus or minus a few KB).
I tried then to load a 72MB file and the memory consuption was
77,532KB with the do{} and 77,452KB without. Not sure why the
difference, but it's definitely not twice more.
Unless of course I overlooked something.
Jenda
===== Jenda@xxxxxxxxxxx === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
.
- Follow-Ups:
- Re: Analize Java source file with perl?
- From: John W. Krahn
- Re: Analize Java source file with perl?
- References:
- Re: Analize Java source file with perl?
- From: Dr.Ruud
- Re: Analize Java source file with perl?
- Prev by Date: Re: win32 services
- Next by Date: Re: Analize Java source file with perl?
- Previous by thread: Re: Analize Java source file with perl?
- Next by thread: Re: Analize Java source file with perl?
- Index(es):
Relevant Pages
|
|