Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Unefficient Regexp 'Matching this or that'

by moritz (Cardinal)
on May 19, 2010 at 10:28 UTC ( #840660=note: print w/replies, xml ) Need Help??


in reply to Re: Unefficient Regexp 'Matching this or that'
in thread Unefficient Regexp 'Matching this or that'

Maybe it shoudl be possible to disable the trie optimisation for thos cases of alternation where it doesn't benefit.
Maybe you can disable trie optimizations by setting ${^RE_TRIE_MAXBUF} = 0?
Perl 6 - links to (nearly) everything that is Perl 6.
  • Comment on Re^2: Unefficient Regexp 'Matching this or that'

Replies are listed 'Best First'.
Re^3: Unefficient Regexp 'Matching this or that'
by BrowserUk (Pope) on May 19, 2010 at 10:33 UTC

    That seems to work. !5 seconds instead of 53 for the alternation is much more reasonable. Still doesn't beat the two pass method, but there is probably a break point somewhere.

    c:\test>junk31 836952.log Benchmark: timing 1 iterations of AAtwo_pass, BBtwo_string, CCone_string ... two pass: 10 AAtwo_pass: 7 wallclock secs ( 5.60 usr + 0.83 sys = 6.43 CPU) @ 0 +.16/s (n=1) (warning: too few iterations for a reliable count) two string: 10 BBtwo_string: 15 wallclock secs (14.35 usr + 0.94 sys = 15.29 CPU) @ + 0.07/s (n=1) (warning: too few iterations for a reliable count) one string: 7 CCone_string: 16 wallclock secs (14.76 usr + 0.73 sys = 15.49 CPU) @ + 0.06/s (n=1) (warning: too few iterations for a reliable count)

    I'm still puzzled why the two pass takes less time than the one string, but the numbers are right and I can't anything major wrong with the benchmark?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://840660]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2018-06-23 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?



    Results (126 votes). Check out past polls.

    Notices?