in reply to How to optimize a regex on a large file read line by line ?

I think you should benchmark where the bottleneck is before taking actions (loop or readline or regex or count. .. and so on).

Anyway a sliding window always reading large chunks and adapting the regex to operate on multiple lines could speed up things a little.

Edit: see  Re: Memory Leak when slurping files in a loop (sliding window explained)

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

  • Comment on Re: How to optimize a regex on a large file read line by line ?