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

new URL is faster #76

Closed
2 tasks done
gurgunday opened this issue Jan 24, 2024 · 6 comments
Closed
2 tasks done

new URL is faster #76

gurgunday opened this issue Jan 24, 2024 · 6 comments

Comments

@gurgunday
Copy link
Member

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the issue has not already been raised

Issue

Since Ada, it seems like new URL's parsing is significantly faster

Maybe we can deprecate this package? The alternative would be to only keep url serialization since URL doesn't have an alternative, but I don't know how much it's used

What do you think?

ast-uri: parse domain x 1,199,118 ops/sec ±0.49% (98 runs sampled)
urijs: parse domain x 448,563 ops/sec ±0.10% (99 runs sampled)
WHATWG URL: parse domain x 2,581,665 ops/sec ±0.16% (97 runs sampled)
fast-uri: parse IPv4 x 1,785,608 ops/sec ±1.27% (95 runs sampled)
urijs: parse IPv4 x 370,294 ops/sec ±2.00% (97 runs sampled)
fast-uri: parse IPv6 x 832,663 ops/sec ±0.94% (98 runs sampled)
urijs: parse IPv6 x 280,835 ops/sec ±0.39% (100 runs sampled)
fast-uri: parse URN x 2,234,727 ops/sec ±0.62% (93 runs sampled)
urijs: parse URN x 1,118,988 ops/sec ±2.55% (94 runs sampled)
WHATWG URL: parse URN x 3,097,084 ops/sec ±0.15% (97 runs sampled)
fast-uri: parse URN uuid x 1,487,851 ops/sec ±0.09% (95 runs sampled)
urijs: parse URN uuid x 816,766 ops/sec ±0.09% (99 runs sampled)
fast-uri: serialize uri x 1,109,413 ops/sec ±0.39% (97 runs sampled)
urijs: serialize uri x 380,730 ops/sec ±0.36% (97 runs sampled)
fast-uri: serialize IPv6 x 365,499 ops/sec ±0.10% (100 runs sampled)
@zekth
Copy link
Member

zekth commented Jan 24, 2024

The main use of this package is for ajv. For reference: ajv-validator/ajv#1862

It might worth giving a shot at ajv creating a uriresolver using new URL on recent node versions.

I don't think we should deprecate it yet because ada is shipped on only recent node versions am i right?

@gurgunday
Copy link
Member Author

gurgunday commented Jan 24, 2024

I see, didn't know that AJV used this package 🙏

I agree that we can do polyfills

@climba03003
Copy link
Member

I don't think we should deprecate it yet because ada is shipped on only recent node versions am i right?

ada is exist on all the supported version of node already.
It the version that do not have ada is EoL.

@zekth
Copy link
Member

zekth commented Jan 24, 2024

It came with v18.17.0 , there's still 16 to support. However we can create the polyfill for AJV but with the slow ramp-up of updates in ajv usage i think fast-uri will still be used for a while. Might be worth updating the benchmarks and readme. I don't think all uses cases the lib supports are covered by new URL

@mcollina
Copy link
Member

This module exists because urijs was absurdly slow and the main bottleneck in Ajv startup. I'm not 100% sure that the algorithm used by fast-uri and WHATWG URL are identical, and JSON Schema definitely needs a URI.

@anonrig
Copy link

anonrig commented Jan 30, 2024

🫡

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

No branches or pull requests

5 participants