News for hackers. Stuff that matters.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by blundergoat on Friday March 20, 2026 @05:58PM (#47461242)
The real win here isn't TS over Rust, it's the O(N²) -> O(N) streaming fix via statement-level caching. That's a 3.3x improvement on its own, independent of language choice. The WASM boundary elimination is 2-4x, but the algorithmic fix is what actually matters for user-perceived latency during streaming. Title undersells the more interesting engineering imo.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by azakai on Friday March 20, 2026 @07:46PM (#47462388)
O(N²) -> O(N) was 3.3x faster, but before that, eliminating the boundary (replacing wasm with JS) led to speedups of 2.2x, 4.6x, 3.0x (see one table back).

It looks like neither is the "real win". both the language and the algorithm made a big difference, as you can see in the first column in the last table - going to wasm was a big speedup, and improving the algorithm on top of that was another big speedup.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by nulltrace on Friday March 20, 2026 @08:01PM (#47462517)
Yeah the algorithmic fix is doing most of the work here. But call that parser hundreds of times on tiny streaming chunks and the WASM boundary cost per call adds up fast. Same thing would happen with C++ compiled to WASM.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by hrmtst93837 on Saturday March 21, 2026 @03:43AM (#47464905)
WASM boundary overhead is only half the story. Once you start bouncing tiny chunks across JS and WASM over and over, the data shuffling and memory layout mismatch can trash cache behavior, pile on allocation churn, and turn a nice benchmark into something that looks nothing like a parser living inside a streaming pipeline. That's why most 'language duel' posts feel beside the point.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by socalgal2 on Friday March 20, 2026 @06:55PM (#47461875)
same for uv but no one takes that message. They just think "rust rulez!" and ignore that all of uv's benefits are algo, not lang.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by estebank on Friday March 20, 2026 @07:09PM (#47462041)
Some architectures are made easier by the choice of implementation language.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by crubier on Friday March 20, 2026 @08:27PM (#47462718)
In my experience Rust typically makes it a little bit harder to write the most efficient algo actually.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by catlifeonmars on Friday March 20, 2026 @11:26PM (#47463706)
That’s usually ok bc in most code your N is small and compiler optimizations dominate.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Defletter on Friday March 20, 2026 @11:37PM (#47463752)
Would you be willing to give an example of this?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by lukeweston1234 on Saturday March 21, 2026 @04:27AM (#47465147)
Not OP, but one example where it is a bit harder to do something in Rust that in C, C++, Zig, etc. is mutability on disjoint slices of an array. Rust offers a few utilities, like chunks_by, split_at, etc. but for certain data structures and algorithms it can be a bit annoying.

It's also worth noting that unsafe Rust != C, and you are still battling these rules. With enough experience you gain an understanding of these patterns and it goes away, and you also have these realy solid tools like Miri for finding undefined behavior, but it can be a bit of a hastle.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by catlifeonmars on Saturday March 21, 2026 @10:53AM (#47467593)
Has no one written a python! macro for this use case?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by foldr on Saturday March 21, 2026 @06:47AM (#47465877)
Mutating tree structures tends to be a fiddle (especially if you want parent pointers).
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by EdwardDiego on Saturday March 21, 2026 @12:37AM (#47464024)
UV also has the distinct advantage in dependency resolution that it didn't have to implement the backwards compatible stuff Pip does, I think Astral blogged on it. If I can find it, I'll edit the link in.

edit wasn't Astral, but here's the blog post I was thinking of. https://nesbitt.io/2025/12/26/how-uv-got-so-fast.html

That said, your point is very much correct, if you watch or read the Jane Street tech talk Astral gave, you can see how they really leveraged Rust for performance like turning Python version identifiers into u64s.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rowanG077 on Friday March 20, 2026 @07:48PM (#47462410)
That's a pretty big claim. I don't doubt that a lot of uv's benefits are algo. But everything? Considering that running non IO-bound native code should be an order of magnitude faster than python.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by thfuran on Friday March 20, 2026 @08:10PM (#47462586)
More than one, I'd think.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by jeremyjh on Friday March 20, 2026 @08:32PM (#47462762)
Its a pretty well-supported claim. uv skips doing a number of things that generate file I/O. File I/O is far more costly than the difference in raw computation. pip can't drop those for compatibility reasons.

https://nesbitt.io/2025/12/26/how-uv-got-so-fast.html

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rowanG077 on Friday March 20, 2026 @09:00PM (#47462949)
I don't think the article you linked supports the claim that none of UV performance improvements are related to using rust over python at all. In fact it directly states the exact opposite. They have an entire section dedicated to why using Rust has direct performance advantages for UV.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by jeremyjh on Friday March 20, 2026 @10:24PM (#47463425)
What it says is this:

> uv is fast because of what it doesn’t do, not because of what language it’s written in. The standards work of PEP 518, 517, 621, and 658 made fast package management possible. Dropping eggs, pip.conf, and permissive parsing made it achievable. Rust makes it a bit faster still.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rowanG077 on Friday March 20, 2026 @10:33PM (#47463468)
Yes exactly! That quote directly disproves that all of the improvements UV has over competitors is because of algos, not because of rust.

So the claim is not well supported at all by the article as you stated, in fact the claim is literally disproven by the article.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by kyralis on Friday March 20, 2026 @11:55PM (#47463817)
This is either an overly pedantic take or a disingenuous one. The very first line that the parent quoted is

> uv is fast because of what it doesn’t do, not because of what language it’s written in.

The fact that the language had a small effect ("a bit") does not invalidate the statement that algorithmic improvements are the reason for the relative speed. In fact, there's no reason to believe that rust without the algorithmic version would be notably faster at all. Sure, "all" is an exaggeration, but the point made still stands in the form that most readers would understand it: algorithmic improvements are the important difference between the systems.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rowanG077 on Saturday March 21, 2026 @12:08AM (#47463883)
You are glossing over the fact that the original statement I was commenting on was literally that ALL improvements UV has are due to algorithms and not due to rust.

So this:

> The statement that algorithmic improvements are the reason for the relative speed.

Was not at all the statement that I was attacking. For one because I don't disagree with that statement. I even point to this in my very first comment:

> I don't doubt that a lot of uv's benefits are algo. But everything?

You and the other person are trying to pull a classic motte and bailey. Attempting to make it look as if I'm attacking the very reasonable position that algorithms are the bulk of the improvements why UV is fast.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by ambicapter on Saturday March 21, 2026 @01:45PM (#47469328)
You are being very pedantic here.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by jeremyjh on Friday March 20, 2026 @10:53PM (#47463573)
You are right. 99% is not 100%.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by rowanG077 on Friday March 20, 2026 @11:20PM (#47463682)
I don't think the article has substantive numbers. You'd have to re-implement UV in python to do that. I don't think anyone did that. It would be interesting at least to see how much UV spends in syscalls vs PIP and make a relative estimate based on that.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @01:22AM (#47464209)
Do you actually believe that UV would be as fast if it were written in Python?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tinco on Saturday March 21, 2026 @03:59AM (#47464981)
It would come pretty close, probably close enough that you wouldn't be able to tell the difference on 90% of projects.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @04:11AM (#47465063)
Vague. What's pretty close? I mean, even for IO bound tasks you can pretty quickly validate that the performance between languages is not close at all.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tinco on Saturday March 21, 2026 @04:24AM (#47465125)
Sure, within 100ms. Who cares what the performance multiples are?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @04:26AM (#47465142)
That literally makes no sense. 100ms... out of what? Is it 1ms vs 100ms? 100000ms vs 100100ms?

Anyway, dubious claim since a Python interpreter will take 10s of milliseconds just to print out its version.

Do you have any evidence? I can point at techempower benchmarks showing IO bound tasks are still 10-100x faster in native languages vs Python/JS.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tinco on Saturday March 21, 2026 @04:28AM (#47465153)
I'm saying that the Rust might execute in 50ms and the Python in 150ms. You are the one not making sense, we are talking about application performance, why are you not measuring that in milliseconds.

That is assuming Rust is 100x faster than Python btw, 49ms of I/O, 1ms of Rust, 100ms of Python.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @08:44AM (#47466527)
> I'm saying that the Rust might execute in 50ms and the Python in 150ms.

Okay, so the Rust code would be 3x as fast. Feels arbitrary, but sure.

> You are the one not making sense, we are talking about application performance, why are you not measuring that in milliseconds.

I explained why your post made no sense already...

> That is assuming Rust is 100x faster than Python btw, 49ms of I/O, 1ms of Rust, 100ms of Python.

That's not how anything works. Different languages will perform differently on IO work, different runtimes will degrade under IO differently, etc. That's why even basic echo HTTP servers perform radically differently in Python vs Rust.

This isn't how computers work and it's not even how math works.

This conversation has become nonsensical. The thing we can agree with is this - no, uv would not be as fast if it were written in Python.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tinco on Saturday March 21, 2026 @10:25AM (#47467319)
> That's not how anything works. Different languages will perform differently on IO work, different runtimes will degrade under IO differently, etc. That's why even basic echo HTTP servers perform radically differently in Python vs Rust.

> This isn't how computers work and it's not even how math works.

What are you disagreeing with? There's some baseline amount of I/O that the kernel does for you, that's what I'm assuming is 50ms, and everything else like runtime degrading is overhead due to the language/platform choice. I'm saying Rust is upwards of 100x faster in that regard thanks to its zero cost abstraction philosophy. You can't just include the I/O baseline in a claim about Rust's performance advantage. You'll be really disappointed when Rust doesn't download your files 100x as fast as the Python file downloader.

Anyway, I'm sorry I provoked your antagonism with my terse messages, I wasn't trying to be blase. I believe uv is the sort of tool that wouldn't suffer much from the downsides of Python and that in most situations the reduced runtime overhead of Rust would have a negligible impact on the user experience. I'm not arguing that they shouldn't build uv in Rust. Most situations is not all situations, and when a tool is used so widely you'll hit all edge cases, from the point where the 10s of milliseconds of startup time matters to the point where Pythons I/O overhead matters at scale.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @07:43PM (#47472757)
I think a missing piece here is that you think that Rust won't download a file faster than Python but it absolutely can. This seems to just be a misconception people have about IO, like "download a file" is a thing that exists wholly outside of your process.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by tinco on Sunday March 22, 2026 @02:57AM (#47475106)
I know it can, but it can't download it faster than the network card can write it into its buffers. That's the part I would count as the 50ms that both can't improve upon.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Sunday March 22, 2026 @08:22AM (#47476766)
Of course. But why would that matter if Python can't get there to begin with? You're not going to hit NIC bottlenecks with Python, not without a ton of work and tradeoffs at least.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by jeremyjh on Saturday March 21, 2026 @10:05AM (#47467150)
> Different languages will perform differently on IO work,

IO is executed by kernel, file system or network drivers. IO performance is not dependent at all on which language makes the syscalls.

> The thing we can agree with is this - no, uv would not be as fast if it were written in Python.

In this thread, we are talking about the speed of uv in terms of user experience - how long a person waits for command line operations to complete. Things that pip takes multiple seconds to do, uv will do in dozens of milliseconds. If uv were written in python, it would take dozens of ms + a few dozens more, which means absolutely fuck all nothing in the context of the thousands of milliseconds saved over pip.

Its possible a user might perceive a slight difference in larger projects, but if pip had been uv-but-in-python, the uv-in-rust project would never have been started in the first place because no one would have bothered switching.

> This conversation has become nonsensical.

Agreed. No one in this thread is disputing that Rust code is faster than Python, only that in this case it is completely insignificant in the face of all the useless file and network I/O that pip is doing, and uv is not.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by staticassertion on Saturday March 21, 2026 @07:22PM (#47472597)
> IO is executed by kernel, file system or network drivers. IO performance is not dependent at all on which language makes the syscalls.

I think your posts on this topic can not possibly be worth responding to if you're coming to the conversation with this level of not understanding things.

Your post is a combination of not understanding computers and then hand waving about fake numbers and user expectations. IO is not magic, it is not some distinct process that you have no control over from userland, it is exactly the sort of thing that Python does very poorly at, in fact.

I'll just reference techempower again, or you can look up those system calls you referenced like how epoll works and then look into what is involved for Python to use epoll effectively.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by coldtea on Saturday March 21, 2026 @07:36AM (#47466116)
Just the fact that I can install a single binary is 10x better than an equally fast Python implementation.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by Aurornis on Friday March 20, 2026 @06:45PM (#47461763)
> Title undersells the more interesting engineering imo.

Thanks for cutting through the clickbait. The post is interesting, but I'm so tired of being unnecessarily clickbaited into reading articles.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by sroussey on Friday March 20, 2026 @06:42PM (#47461728)
Yeah, though the n^2 is overstating things.

One thing I noticed was that they time each call and then use a median. Sigh. In a browser. :/ With timing attack defenses build into the JS engine.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by fn-mote on Friday March 20, 2026 @07:52PM (#47462437)
For those of us not in the know, what are we expecting the results of the defenses to be here?
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by sroussey on Saturday March 21, 2026 @12:28AM (#47463983)
Jitter. It make precise timings unreliable. Time the entire time of 1000 runs and divide by 1000 instead of starting and stopping 1000 timers.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by shmerl on Friday March 20, 2026 @06:23PM (#47461509)
More like a misleading clickbait.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by catlifeonmars on Friday March 20, 2026 @11:22PM (#47463697)
You’re not wrong, but that win would not get as many views. It’s not clickbaity enough
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by adastra22 on Saturday March 21, 2026 @01:14AM (#47464176)
No AI generated comments on HN please.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by wolvesechoes on Saturday March 21, 2026 @06:29AM (#47465798)
> The real win here isn't TS over Rust

Kinda is. We came up with abstractions to help reason about what really matters. The more you need to deal with auxillary stuff (allocations, lifetimes), more likely you will miss the big issue.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by coldtea on Saturday March 21, 2026 @07:35AM (#47466112)
The opposite: the more you rely on abstractions the more you miss the lower level optimization opportunities and loose understanding of algorithms and hardware.
Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by wolvesechoes on Saturday March 21, 2026 @07:53AM (#47466210)
> of algorithms

Yes, sprinkling your code logic with malloc, .clone() or lifetime annotations on the other hand brings algorithmic enlightenment.

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by coldtea on Saturday March 21, 2026 @10:11AM (#47467205)
Dealing and having to think about the cost of malloc, clone() and lifetimes, brings algorithmic enlightenment more than working on an high abstraction ivory tower where things "magically happen".

Is your argument that the average Python or Typescript dev gets to think and care more about algorithms than the average C/C++/Rust dev?

Re:We rewrote our Rust WASM Parser in TypeScript – and it go... by zahrevsky on Saturday March 21, 2026 @11:23AM (#47467858)
They even directly conclude at the end of the article that improvements in algorithm are more important than the choice of language:

> Algorithmic complexity improvements dominate language-level optimisations. Going from O(N²) to O(N) in the streaming case had a larger practical impact than switching from WASM to TypeScript.

Yet they still have chosen to put the “Rust rewrite” part in the title. I almost think it's a click bait.