Is this really that much easier than matching paths and query strings yourself? I'm glad that there is an official API now, but this article didn't really show me anything to get excited about as someone who has built several client-side routers from scratch.
URLPattern can be plenty fast if you use them in a fast data structure, like a prefix tree as pointed out in that first link. And there's no reason why URLPattern can't do that.
So I went and made an implementation of URLPatternList that uses a prefix tree and is 20-30x faster than a linear scan for large lists of URLPatterns: https://github.com/justinfagnani/url-pattern-list
Whose implementation, specifically? I don't think as specified URLPattern has any inherent performance drawbacks compared to the alternatives, but it seems like V8/NodeJS/Deno definitely didn't thought closely and/or clearly about performance when they did theirs.
All three of those use the same implementation. I would hope that this will be improved over time, but it's not a guarantee by any stretch of the imagination.
Thanks, I wasn't sure, as I thought Deno used V8 but then the issue linked earlier shared "The implementation of URLPattern in Deno is super non-performant" so it seemed to me like Deno maybe had their own implementation instead of using the V8 one.
The thing is, performance in that particular context hardly matters, unless you're forcing users to switch pages faster than 1 page per second. Even if each resolving takes 0.1 seconds (which be bad, don't get me wrong), 99% of users wouldn't notice a thing, and if you're a small agency/shop/company/team, focusing on more general things tends to be time spent better.
Imagine doing a call to a remote authentication service to check who has access to what :) Regardless, performance is usually not the biggest problem in those types of routers.