in reply to Re: grepping a large file and stopping on first match to a list
in thread grepping a large file and stopping on first match to a list
a more interesting question is: does the expression $map =~ m"^(.*)$"gm put 861_600 lines on perl's argument stack before even calling first? It does, which IMO kind of defeats the purpose of "stopping on the first match".
Ah, so it's the loading of the entire file that's slowing me down. And you say that your and kcott's solutions don't avoid that. (Thank you both for them!) Any idea what can, if anything?
If it helps (and to address some of the questions in kcott's reply), the file is text, with a maximum line length of (I'm estimating now, since I don't have it at hand) a few hundred bytes, and is static (meaning unchanging, so that I can, if necessary, include it in my Perl script instead of opening it as a file).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: grepping a large file and stopping on first match to a list
by Athanasius (Archbishop) on Feb 23, 2016 at 07:57 UTC | |
by msh210 (Monk) on Feb 23, 2016 at 15:32 UTC | |
|
Re^3: grepping a large file and stopping on first match to a list
by Anonymous Monk on Feb 23, 2016 at 08:01 UTC | |
|
Re^3: grepping a large file and stopping on first match to a list [no modules]
by kcott (Archbishop) on Mar 23, 2016 at 10:34 UTC |