Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex optimizer on \s+$ is "dumb as bricks" #5470

Open
p6rt opened this issue Jul 21, 2016 · 2 comments
Open

Regex optimizer on \s+$ is "dumb as bricks" #5470

p6rt opened this issue Jul 21, 2016 · 2 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 21, 2016

Migrated from rt.perl.org#128693 (status was 'new')

Searchable as RT128693$

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

From @ajs

When given a pathological input that will always fail, /\s+$/ seems to take
the longest way home. Example in the IRC excerpt, below.

From the IRC discussion​:

[14​:11] <timotimo> m​: use nqp; ((" " x 10000) ~ "end") ~~ / \s+$ /; say now
- INIT now
[14​:11] <+camelia> rakudo-moar 68afa3​: OUTPUT«10.1804368␤»
[14​:11] <timotimo> ah. no. it's definitely the regex :)
[14​:11] <harmil> nice test case, though!
[14​:11] <harmil> I'll submit this. At least it will be useful as a note for
the future.
[14​:11] <timotimo> our regex optimizer is dumb as bricks ;)

--
Aaron Sherman, M.​:
P​: 617-440-4332 Google Talk, Email and Google Plus​: ajs@​ajs.com
Toolsmith, developer, gamer and life-long student.

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

From @ajs

Oddly, this also takes a very long time, so I'm no longer certain what the slowdown is​:

time perl6 -e 'my $c = (" " x 10000) ~ "end"; $c ~~ /" " ** 10000..10000 $/ and die'

real 0m15.403s
user 0m15.329s
sys 0m0.046s

@p6rt p6rt added the perf label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant