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

Speed up get_json_pointer #678

Merged
merged 1 commit into from
Oct 13, 2021
Merged

Speed up get_json_pointer #678

merged 1 commit into from
Oct 13, 2021

Conversation

jsha
Copy link
Contributor

@jsha jsha commented Oct 13, 2021

The regex only needs to get called when there's a double quote somewhere
in the input.

Benchmarks below are for the two cases: When there's no double quote, we
skip the regex and go fast. When there is a double quote, we run the
regex and go slow.

test bench_get_json_pointer ... bench: 96 ns/iter (+/- 1)
test bench_get_json_pointer_with_map ... bench: 518 ns/iter (+/- 18)

The regex calls showed up in profiling of rustdoc.

The regex only needs to get called when there's a double quote somewhere
in the input.

Benchmarks below are for the two cases: When there's no double quote, we
skip the regex and go fast. When there is a double quote, we run the
regex and go slow.

test bench_get_json_pointer          ... bench:  96 ns/iter (+/- 1)
test bench_get_json_pointer_with_map ... bench: 518 ns/iter (+/- 18)
@jsha jsha mentioned this pull request Oct 13, 2021
@Keats Keats merged commit 3be477b into Keats:master Oct 13, 2021
@Keats
Copy link
Owner

Keats commented Oct 13, 2021

Thanks!

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.

2 participants