Skip to content

perf: url encode path segments in longer string slices #1026

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 4 commits into from
Mar 5, 2025

Conversation

dsherret
Copy link
Contributor

@dsherret dsherret commented Feb 7, 2025

Before:

test long           ... bench:         250 ns/iter (+/- 11) = 172 MB/s

After:

test long           ... bench:         221 ns/iter (+/- 24) = 248 MB/s

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 68.18182% with 14 lines in your changes missing coverage. Please review.

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

Files with missing lines Patch % Lines
url/src/parser.rs 68.18% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1026   +/-   ##
=======================================
  Coverage        ?   79.93%           
=======================================
  Files           ?       24           
  Lines           ?     4322           
  Branches        ?        0           
=======================================
  Hits            ?     3455           
  Misses          ?      867           
  Partials        ?        0           

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

@@ -1305,7 +1367,7 @@ impl<'a> Parser<'a> {
}
}
if scheme_type.is_file() {
// while urls path’s size is greater than 1
// while url's path’s size is greater than 1
// and url’s path[0] is the empty string,

Choose a reason for hiding this comment

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

Missed a `

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. I missed reverting that after I noticed that kind of quote is used everywhere in the codebase (habit I have because in Deno, we avoid using non-ascii characters in JS because it causes the source code to be stored less efficiently. Example: microsoft/TypeScript#53608). Thanks!

@Scripter17
Copy link

It fully occurred to me how annoying it must be to get a "you missed a smudge" review from a rando on your genuinely very impressive work so I want to redeem myself: You're awesome

URL parsing has been a bit of a bottleneck in my current main project for a while and all your work does a pretty good dent in it

Seeing all your pull requests was a very nice thing to wake up and look forward to

Signed-off-by: David Sherret <[email protected]>
@dsherret
Copy link
Contributor Author

dsherret commented Feb 8, 2025

Not annoying. Thanks!

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

@lucacasonato lucacasonato added this pull request to the merge queue Mar 5, 2025
Merged via the queue into servo:main with commit adb8660 Mar 5, 2025
18 checks passed
kodiakhq bot pushed a commit to pdylanross/fatigue that referenced this pull request Aug 21, 2025
Bumps url from 2.5.4 to 2.5.5.

Release notes
Sourced from url's releases.

v2.5.5
What's Changed

ci: downgrade crates when building for Rust 1.67.0 by @​mxinden in servo/rust-url#1003
ci: run unit tests with sanitizers by @​mxinden in servo/rust-url#1002
fix small typo by @​hkBst in servo/rust-url#1011
chore: fix clippy errors on main by @​dsherret in servo/rust-url#1019
perf: remove heap allocation in parse_query by @​dsherret in servo/rust-url#1020
perf: slightly improve parsing a port by @​dsherret in servo/rust-url#1022
perf: improve to_file_path() by @​dsherret in servo/rust-url#1018
perf: make parse_scheme slightly faster by @​dsherret in servo/rust-url#1025
update LICENSE-MIT by @​wmjae in servo/rust-url#1029
perf: url encode path segments in longer string slices by @​dsherret in servo/rust-url#1026
Disable the default features on serde by @​rilipco in servo/rust-url#1033
docs: base url relative join by @​tisonkun in servo/rust-url#1013
perf: remove heap allocation in parse_host by @​dsherret in servo/rust-url#1021
Update tests to Unicode 16.0 by @​hsivonen in servo/rust-url#1045
Add some some basic functions to Mime by @​mrobinson in servo/rust-url#1047
ran cargo clippy --fix -- -Wclippy::use_self by @​mrobinson in servo/rust-url#1048
Fix MSRV and clippy CI by @​Manishearth in servo/rust-url#1058
Update Url::domain docs to show that it includes subdomain by @​supercoolspy in servo/rust-url#1057
set_hostname should error when encountering colon ':' by @​edgul in servo/rust-url#1060
version bump to 2.5.5 by @​edgul in servo/rust-url#1061

New Contributors

@​mxinden made their first contribution in servo/rust-url#1003
@​hkBst made their first contribution in servo/rust-url#1011
@​wmjae made their first contribution in servo/rust-url#1029
@​rilipco made their first contribution in servo/rust-url#1033
@​tisonkun made their first contribution in servo/rust-url#1013
@​supercoolspy made their first contribution in servo/rust-url#1057

Full Changelog: servo/[email protected]



Commits

a40f904 version bump to 2.5.5 (#1061)
cf305db set_hostname should error when encountering colon ':' (#1060)
88826bd Update Url::domain docs to show that it includes subdomain (#1057)
c3bbf66 Fix MSRV and clippy CI (#1058)
dbd5261 ran cargo clippy --fix -- -Wclippy::use_self (#1048)
9f6e92e Add some some basic functions to Mime (#1047)
68f151c Update tests to Unicode 16.0 (#1045)
7cff874 perf: remove heap allocation in parse_host (#1021)
968e862 docs: base url relative join (#1013)
2ce2e12 Disable the default features on serde. (#1033)
Additional commits viewable in compare view




Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

@dependabot rebase will rebase this PR
@dependabot recreate will recreate this PR, overwriting any edits that have been made to it
@dependabot merge will merge this PR after your CI passes on it
@dependabot squash and merge will squash and merge this PR after your CI passes on it
@dependabot cancel merge will cancel a previously requested merge and block automerging
@dependabot reopen will reopen this PR if it is closed
@dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
@dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
@dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
@dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
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.

3 participants