2 ms·
You're assuming that URLPattern is performant... That doesn't seem to be the case currently. https://adventures.nodeland.dev/archive/you-should-not-use-urlpatt
by jazzypants 11mo ago
You're assuming that URLPattern is performant... That doesn't seem to be the case currently.
https://adventures.nodeland.dev/archive/you-should-not-use-urlpattern-to-route-http/ https://adventures.nodeland.dev/archive/you-should-not-use-u...
https://github.com/denoland/deno/issues/19861 https://github.com/denoland/deno/issues/19861
- embedding-shape 11mo ago> assuming that URLPattern is performant 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.
- jazzypants 11mo agoAll 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.
- embedding-shape 11mo agoThanks, 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.
- spankalee 11mo agoURLPattern 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 https://github.com/justinfagnani/url-pattern-list