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

regexp: make Regexp.Find* allocation free #15643

Closed
valyala opened this issue May 11, 2016 · 0 comments
Closed

regexp: make Regexp.Find* allocation free #15643

valyala opened this issue May 11, 2016 · 0 comments

Comments

@valyala
Copy link
Contributor

@valyala valyala commented May 11, 2016

Currently Regexp.Find and Regexp.FindString allocates memory. This allocation may be easily removed - see the CL. Allocation-free Regexp.Find* functions work a bit faster comparing to the current implementation:

name          old time/op    new time/op    delta
Find-4           345ns ± 0%     313ns ± 1%    -9.13%    (p=0.000 n=9+9)
FindString-4     338ns ± 1%     312ns ± 0%    -7.88%   (p=0.000 n=10+9)

name          old alloc/op   new alloc/op   delta
Find-4           16.0B ± 0%     0.0B ±NaN%  -100.00%  (p=0.000 n=10+10)
FindString-4     16.0B ± 0%     0.0B ±NaN%  -100.00%  (p=0.000 n=10+10)

name          old allocs/op  new allocs/op  delta
Find-4            1.00 ± 0%     0.00 ±NaN%  -100.00%  (p=0.000 n=10+10)
FindString-4      1.00 ± 0%     0.00 ±NaN%  -100.00%  (p=0.000 n=10+10)
@bradfitz bradfitz added this to the Go1.8 milestone May 11, 2016
@gopherbot gopherbot closed this in bea39e6 Sep 6, 2016
@golang golang locked and limited conversation to collaborators Sep 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.