frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

URL Pattern API

https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
33•thunderbong•2h ago

Comments

jauntywundrkind•2h ago
Great tool. So glad we have something!

Alas, also has mis-use. You don't want to linearly parse urls, as a router! Addition was controversial because folks anticipated mis-use like this. https://news.ycombinator.com/item?id=46043318

mdhb•1h ago
Can you talk more about this… I was under the impression that was the EXPLICIT reason [1] why it was added in the first place or did I misread your comment?

It’s also something the Lit team uses like here: https://www.npmjs.com/package/@lit-labs/router

I think maybe we are just debating the data structure the hold the patterns? Like it should be a trie rather than say a Set or Map.

[1] https://developer.chrome.com/docs/web-platform/urlpattern

tshaddox•1h ago
It would take a very large number of routes before linear search would become a noticeable performance problem.

At that point, you’d probably be splitting the router itself into multiple client bundles, with something at the root to quickly match the URL with a bundle of routes (maybe a hash table on the first URL segment, or even a trie).

This URLPattern library and linear search would still be a reasonable choice for implementing each individual route bundle. And in practice, just do it the naive way until it actually becomes a problem.

BiteCode_dev•54m ago
I just tried to match a URL against about a hundred patterns of various types (thanks to Claude code), expecting it to be a non-issue.

A hundred regex tests, for example, is generally very fast. A quick Python script made them run in 0.85ms. A hundred Flask router tests is 2.64ms.

So I had no reason to think this API would be slow. Surely matching a URL is a subset of generalized regexes and can only be fast? And given that routing is not an activity you do a lot, why would it matter anyway?

But the performances were atrocious: it took 8 seconds to resolve the worst-case scenario on Firefox, and it locked the entire browser UI.

Ok, note to self, stay away from the URL Pattern API.

creatonez•19m ago
...Eight seconds for a hundred matches? What does your code look like?
petesergeant•1h ago
> Note: This feature is available in Web Workers.

... is _also_ available in Web Workers, or _only_ available in Web Workers?

potsandpans•1h ago
Also
socketcluster•11m ago
I don't like this API.

Overall I dislike the shift away from a URL as a language-agnostic string primitive to some weird convoluted object which is limited to specific use cases.

URL literally stands for Universal Resource Locator... A string is Universal. It can be passed around easily between processes, it can be easily stored in a database, it can be easily shared online, it can be easily passed to an LLM... URLs were supported by LLMs before LLMs even existed! You've got to appreciate that!

This class they call URL is actually not a URL at all, it's more like a bound URLParser or URLExtractor.

A URL is a string that's a fact. Even ask Google; "is a URL a string?" it will say yes.

The idea of a URL instance as a language-specific construct is a bad idea. It's one of the reasons why many people don't like Java.

echoangle•7m ago
The class isn’t called URL, it’s called URLPattern. Because it represents a pattern that URLs can be matched against.

Python 3.15’s interpreter for Windows x86-64 should hopefully be 15% faster

https://fidget-spinner.github.io/posts/no-longer-sorry.html
286•lumpa•9h ago•91 comments

CUDA Tile Open Sourced

https://github.com/NVIDIA/cuda-tile
112•JonChesterfield•6d ago•28 comments

The entire New Yorker archive is now digitized

https://www.newyorker.com/news/press-room/the-entire-new-yorker-archive-is-now-fully-digitized
288•thm•5d ago•43 comments

Archiving Git branches as tags

https://etc.octavore.com/2025/12/archiving-git-branches-as-tags/
59•octavore•3d ago•16 comments

The Program 2025 annual review: How much money does an audio drama podcast make?

https://programaudioseries.com/the-program-results-7/
19•I-M-S•3d ago•2 comments

UBlockOrigin and UBlacklist AI Blocklist

https://github.com/laylavish/uBlockOrigin-HUGE-AI-Blocklist
67•_____k•2h ago•19 comments

Show HN: Lamp Carousel – DIY kinetic sculpture powered by lamp heat (2024)

https://evan.widloski.com/posts/spinners/
51•Evidlo•1d ago•7 comments

All I Want for Christmas Is Your Secrets: LangGrinch hits LangChain Core

https://cyata.ai/blog/langgrinch-langchain-core-cve-2025-68664/
51•shahartal•4h ago•25 comments

I sell onions on the Internet (2019)

https://www.deepsouthventures.com/i-sell-onions-on-the-internet/
322•sogen•6h ago•96 comments

Asahi Linux with Sway on the MacBook Air M2 (2024)

https://daniel.lawrence.lu/blog/2024-12-01-asahi-linux-with-sway-on-the-macbook-air-m2/
146•andsoitis•8h ago•125 comments

Paperbacks and TikTok

https://calnewport.com/on-paperbacks-and-tiktok/
17•zdw•3d ago•0 comments

Google is 'gradually rolling out' option to change your gmail.com address

https://9to5google.com/2025/12/24/google-change-gmail-addresses/
40•geox•1h ago•13 comments

Fahrplan – 39C3

https://fahrplan.events.ccc.de/congress/2025/fahrplan/
52•rurban•4h ago•0 comments

Phoenix: A modern X server written from scratch in Zig

https://git.dec05eba.com/phoenix/about/
613•snvzz•1d ago•364 comments

Geometric Algorithms for Translucency Sorting in Minecraft [pdf]

https://douira.dev/assets/document/douira-master-thesis.pdf
25•HeliumHydride•6d ago•5 comments

Alzheimer’s disease can be reversed in animal models? Study

https://case.edu/news/new-study-shows-alzheimers-disease-can-be-reversed-achieve-full-neurologica...
397•thunderbong•7h ago•91 comments

We invited a man into our home at Christmas and he stayed with us for 45 years

https://www.bbc.co.uk/news/articles/cdxwllqz1l0o
854•rajeshrajappan•12h ago•205 comments

Clearspace (YC W23) Is Hiring a Founding Network Engineer (VPN and Proxy)

https://www.ycombinator.com/companies/clearspace/jobs/5LtM86I-founding-network-engineer-at-clears...
1•anteloper•5h ago

Tell HN: Merry Christmas

1830•basilikum•1d ago•399 comments

Toys with the highest play-time and lowest clean-up-time

https://joannabregan.substack.com/p/toys-with-the-highest-play-time-and
237•surprisetalk•1w ago•138 comments

URL Pattern API

https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API
33•thunderbong•2h ago•9 comments

The First Photographs of Snowflakes Discover the Groundbreaking Microphotography (2017)

https://www.openculture.com/2017/12/the-first-photographs-of-snowflakes.html
86•_____k•1w ago•14 comments

Show HN: Minimalist editor that lives in browser, stores everything in the URL

https://github.com/antonmedv/textarea
425•medv•1d ago•157 comments

Show HN: Spice Cayenne – SQL acceleration built on Vortex

https://spice.ai/blog/introducing-spice-cayenne-data-accelerator
34•lukekim•1w ago•4 comments

Fabrice Bellard Releases MicroQuickJS

https://github.com/bellard/mquickjs/blob/main/README.md
1432•Aissen•2d ago•538 comments

The Inner-Platform Effect (2006)

https://thedailywtf.com/articles/The_Inner-Platform_Effect
33•birdculture•3d ago•10 comments

Who Watches the Waymos? I do [video]

https://www.youtube.com/watch?v=oYU2hAbx_Fc
260•notgloating•22h ago•90 comments

Show HN: Exploring Mathematics with Python

https://coe.psu.ac.th/ad/explore/
218•Andrew2565•6d ago•22 comments

Ask HN: How do I bridge the gap between PhD and SWE experiences?

71•ecophyseis•1w ago•52 comments

Asterisk AI Voice Agent

https://github.com/hkjarral/Asterisk-AI-Voice-Agent
182•akrulino•23h ago•103 comments