in reply to Re: Multiple patterns match in a big file and track the counts of each pattern matched
in thread Multiple patterns match in a big file and track the counts of each pattern matched

Thank you so much for such a detailed explanation and the piece of code. It works as expected, but takes similar time to my code. Mine takes 1min 35 secs and this takes 1min 32secs. Can you please help me to optimize it at least up to 40 secs ? waiting for your response :)

  • Comment on Re^2: Multiple patterns match in a big file and track the counts of each pattern matched

Replies are listed 'Best First'.
Re^3: Multiple patterns match in a big file and track the counts of each pattern matched
by siberia-man (Friar) on Dec 04, 2017 at 19:59 UTC
    Definitely, 1GB file is quite huge! Do you really think that it is possible to improve the performance in this case? Any way there are two another hints given by other monks: 1) use index or 2) combine few small regexps into the bigger one. Also you can remove the part creating the regexps out of the loop: create regexps before looping and use "compiled" regexps within the loop.