Computing cost and elapsed time

Feb 19, 2012 18:35

Okay, I admit that opening a file 14334 times to see if it has a line matching the current item may not be the most efficient thing to do. In hindsight, reading the whole 2396 line data set (432 Kb) into memory might have been a better thing to do. *Taps watch ( Read more... )

tech

Leave a comment

Comments 1

gemsling February 19 2012, 07:44:27 UTC
Newbie regexp question. If I'm looking for "foo" at the start of the line, with something like this:

$found = "1", if /^($item):text/i;

...is perl smart enough to stop searching if the first letter is not 'f'? (I suspect that it is, but also that it makes little difference, as the cost comes from reading from the file, not comparing strings in memory.)

Reply


Leave a comment

Up