in reply to Re^4: RE on lines read from in-memory scalar is very slow
in thread RE on lines read from in-memory scalar is very slow
Couple other additions to assortment of facts:
if loops are changed to
while(my $s = <$fh>) { $s =~ /^ ?Query/ && $match_count1++; }
then deterioration gets significantly worse (compare to parent node):
v5.32.1 tempfile.txt is size 29 Mb 0.121957 read lines from disk and do RE (32571 matches). 9.511288 read lines from in-memory file and do RE (32571 matches).
if loops are changed to
while(my $s = <$fh>) { index( $s, 'Query' ) != -1 && $match_count1++;; }
(the same without the "$s") then using in-memory string is (of course) faster:
v5.32.1 tempfile.txt is size 29 Mb 0.092390 read lines from disk and do RE (32571 matches). 0.051797 read lines from in-memory file and do RE (32571 matches).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: RE on lines read from in-memory scalar is very slow
by afoken (Chancellor) on Jan 24, 2024 at 13:41 UTC | |
by hippo (Archbishop) on Jan 24, 2024 at 13:52 UTC | |
by afoken (Chancellor) on Jan 24, 2024 at 18:46 UTC |