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

slowdown in regex replacement #48630

Open
stevengj opened this issue Feb 10, 2023 · 0 comments
Open

slowdown in regex replacement #48630

stevengj opened this issue Feb 10, 2023 · 0 comments
Labels
domain:strings "Strings!" kind:regression Regression in behavior compared to a previous version performance Must go faster

Comments

@stevengj
Copy link
Member

This regex benchmark from #40484 (comment):

using BenchmarkTools
s = "elephant giraffe antelope lion cheetah, "^1000;
const reg = r"elephant|giraffe|antelope|lion|cheetah"
const rep = Dict("elephant"=>"grey", "giraffe"=>"yellow", "antelope"=>"brown", "lion"=>"gold", "cheetah"=>"yellow")
@btime replace($s, $(reg=>(s->rep[s])));

on Julia 1.8.2 gives (on my x86_64 laptop):

  649.743 μs (4 allocations: 47.19 KiB)

but on master (1.10.0-DEV.551) gives:

  790.071 μs (4 allocations: 47.19 KiB)

a 20% slowdown.

The other benchmark @btime replace($s, "elephant"=>"grey", "giraffe"=>"yellow", "antelope"=>"brown", "lion"=>"gold", "cheetah"=>"yellow"); in that issue is actually 10% faster on master, so it's not all bad news.

cc @vtjnash

@stevengj stevengj added performance Must go faster kind:regression Regression in behavior compared to a previous version domain:strings "Strings!" labels Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:strings "Strings!" kind:regression Regression in behavior compared to a previous version performance Must go faster
Projects
None yet
Development

No branches or pull requests

1 participant