Skip to content

perf: remove heap allocation in parse_query #1020

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

Merged
merged 8 commits into from
Feb 6, 2025

Conversation

dsherret
Copy link
Contributor

@dsherret dsherret commented Feb 6, 2025

Also updates parse_fragment to work similarly to how parse_query works now where it operates on longer string slices for percent decoding, which helps to not have to do that for every character.

Before:

test long           ... bench:         302 ns/iter (+/- 42) = 142 MB/s
test fragment       ... bench:         370 ns/iter (+/- 9) = 140 MB/s

After:

test long           ... bench:         243 ns/iter (+/- 7) = 176 MB/s
test fragment       ... bench:         275 ns/iter (+/- 9) = 189 MB/s

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 75.71429% with 17 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@ffca1ef). Learn more about missing BASE report.

Files with missing lines Patch % Lines
url/src/parser.rs 75.71% 17 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1020   +/-   ##
=======================================
  Coverage        ?   80.22%           
=======================================
  Files           ?       24           
  Lines           ?     4258           
  Branches        ?        0           
=======================================
  Hits            ?     3416           
  Misses          ?      842           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

Great!

@dsherret dsherret requested a review from lucacasonato February 6, 2025 18:43
Copy link
Collaborator

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@lucacasonato lucacasonato added this pull request to the merge queue Feb 6, 2025
Merged via the queue into servo:main with commit c7abab2 Feb 6, 2025
18 checks passed
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