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

Convert string to bytes once only when doing string filtering. #1405

Merged
merged 1 commit into from
Dec 12, 2019
Merged

Convert string to bytes once only when doing string filtering. #1405

merged 1 commit into from
Dec 12, 2019

Conversation

pstibrany
Copy link
Member

This is trivial change that moves conversion out of returned function. This makes it slightly faster:

name              old time/op    new time/op    delta
ContainsFilter-4    18.2ns ± 2%     9.8ns ± 1%  -46.20%  (p=0.000 n=10+8)

name              old alloc/op   new alloc/op   delta
ContainsFilter-4     0.00B          0.00B          ~     (all equal)

name              old allocs/op  new allocs/op  delta
ContainsFilter-4      0.00           0.00          ~     (all equal)

This makes it slightly faster:

name              old time/op    new time/op    delta
ContainsFilter-4    18.2ns ± 2%     9.8ns ± 1%  -46.20%  (p=0.000 n=10+8)

name              old alloc/op   new alloc/op   delta
ContainsFilter-4     0.00B          0.00B          ~     (all equal)

name              old allocs/op  new allocs/op  delta
ContainsFilter-4      0.00           0.00          ~     (all equal)

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Copy link
Contributor

@cyriltovena cyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyriltovena cyriltovena merged commit 7bb77ec into grafana:master Dec 12, 2019
@pstibrany pstibrany deleted the contains-byte-conversion branch December 12, 2019 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants