[whatwg/url] Add fast path to pathname start state (PR #847)

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%. https://github.com/ada-url/ada/pull/59


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/url-whatwg/847.html" title="Last updated on Dec 9, 2024, 3:54 PM UTC (7962524)">Preview</a> | <a href="https://whatpr.org/url/847/7f3e3b6...7962524.html" title="Last updated on Dec 9, 2024, 3:54 PM UTC (7962524)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/url/pull/847

-- Commit Summary --

  * Add fast path to pathname start state

-- File Changes --

    M url.bs (3)

-- Patch Links --

https://github.com/whatwg/url/pull/847.patch
https://github.com/whatwg/url/pull/847.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/847
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/url/pull/847@github.com>

Received on Monday, 9 December 2024 15:55:02 UTC