|Just another Perl shrine|
5.10.0 regex slowdownby BrowserUk (Pope)
|on Feb 21, 2008 at 00:33 UTC||Need Help??|
BrowserUk has asked for the
wisdom of the Perl Monks concerning the following question:
The following code builds a large alternation regex which on 5.10.0 should cause demerphq's cool tries code to kick in, and it seems to. When I specify 13,104 alternations, it can search a 1MB string in under 3 seconds which is very impressive. However, if I increase it by one alternation to 13,105, it suddenly goes pathelogical and takes 646 seconds to complete the same task.
The alternations I am using are 10-chars giving an array size of 13,105 * 10 + internals ~= 128k. This number rings a bell. I seem to recall that this is the magic number at which memory allocations bypass the normal allocation mechanism and go straight to allocating virtual memory? I've done a cursory grep of the sources trying to confirm this without success. Does anyone know anything about it?
It would also be useful to know if 5.10 builds other than AS1000 are similarly affected. If anyone with such a build has the time to try this out for me, the required command line options are shown after the __END__ token below:
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.