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

Add fast path to pathname start state #847

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anonrig
Copy link
Contributor

@anonrig anonrig commented Dec 9, 2024

This particular change adds a fast-path for implementors. We already use this in Ada (available at https://github.com/ada-url/ada/blob/main/src/parser.cpp#L650).

This change removes the performance penalty of URLs ending with /. As someone can imagine, it's pretty common for a user to send a request to https://ada-url.com/.

This particular change improved the performance of Ada ~9-10%. ada-url/ada#59


Preview | Diff

@rmisev
Copy link
Member

rmisev commented Dec 9, 2024

  1. As the title says, this optimization must be in path start state, but you added it to relative slash state; by mistake?
  2. I think this optimization can be applied if c is /, \ or EOF, not just /. After all, http://h/, http://h\ and http://h are parsed to http://h/.
  3. I guess the added step must return url, not output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants