Remix.run Logo
▲ AbuAssar 8 hours ago

According to voidzero, this port is up to 8x faster than TS 7.0 & ~70% less memory.

Microsoft should seriously consider porting typescript to rust at this point

▲aleksandrm 7 hours ago | parent | next [-]

I'm pretty sure they already considered it before settling on Go. Allegedly, they chose Go because it was easier to translate to.

▲satvikpendem 5 hours ago | parent [-]

That was pre-AI. Ironically if they waited just another year they could've done this port directly to Rust themselves.

▲nish__ an hour ago | parent [-]

Not really because this port is based on the Go version. I doubt it would be as easy for an LLM to port the TS 6 codebase.

▲ndr 7 hours ago | parent | prev | next [-]

I wonder how more frustrating is it to work on the compiler in rust vs go.

IIRC at the time of the port to go they wanted fast test and compile time, of course it's a different era now.

▲ 5 hours ago | parent | next [-]
[deleted]
▲lemagedurage 6 hours ago | parent | prev [-]

That's interesting. A go version to iterate on the code and a rust version to run the code might be an optimal split here.

▲tgv 7 hours ago | parent | prev | next [-]

Idk. Apart from the fact that benchmarks are generally of questionable value, what's the point? Is the TS compiler unbearably slow?

▲TheMrZZ 7 hours ago | parent | next [-]

The success of "modern" CLI tools written in Rust (uv, oxlint, turbopack) show there's a clear demand for faster tools in general.

Also, faster feedback loop is crucial for AIs, so I guess this makes sense.

▲pjmlp 7 hours ago | parent [-]

What they show is that JavaScript should never have left the browser into the backend.

Don't rewrite into Rust, Go, Java, .NET, Zig, Odin, whatever.

Start with them directly.

▲ruther4d 7 hours ago | parent | prev | next [-]

They say the point in the article - WASM

▲msdz 7 hours ago | parent [-]

(Not sure if this could be a genuine remark or is more of a joke, but)

Why not vibecode a Go -> WASM cross-compiler, then?

▲AbuAssar 7 hours ago | parent | next [-]

Go needs a garbage collector while rust doesn’t.

▲Lvl999Noob 7 hours ago | parent | next [-]

Wasm comes with a garbage collector though, no? So a garbage collected language that offloads all memory management to the runtime would actually be better than one that ignored the platform and does its own stuff.

▲zamalek 7 hours ago | parent | next [-]

Apparently there were some design issues (raised and ignored) that made it unusable for many languages.

▲kg 3 hours ago | parent [-]

Ignored is a little unfair to the Wasm committee, the Wasm GC is constrained by what is possible to ship in existing Wasm runtimes and the stuff needed by many languages is way beyond what those existing runtimes have available to them.

I think it made sense for them to compromise, at least on the initial version of Wasm GC, to get it out the door. I say this as someone who wants the features that got left out, like interior references :)

▲ 5 hours ago | parent | prev | next [-]
[deleted]
▲Tadpole9181 7 hours ago | parent | prev [-]

The JVM alone has, what, 4 different modern GCs now? Garbage collectors aren't really universal, so they can pose different issues for different languages.

▲ 5 hours ago | parent [-]
[deleted]
▲msdz 7 hours ago | parent | prev [-]

Yes, of course, but couldn’t you have/make one in WASM too? (I have no clue how memory is allocated there)

▲jerf 7 hours ago | parent [-]

Yes, and when you ship a Go WASM package it is already included. But it has a certain impedence mismatch with WASM since it is rolling its own stuff that WASM can't see, I believe the performance is a bit less good than it could be, and it results in very large WASM packages for small amounts of code.

Since a typescript compiler isn't "a small amount of code", you'd have to see specific numbers on the final WASM assembly size to know how relevant that is. I'd expect well-written Rust code to beat well-written Go code on final assembly size by some amount, which may or may not be relevant to any particular use case (since in a lot of cases one "couple dozen megabytes" is much the same as another when it really gets down to it, it's not like Go is going to be emitting gigabytes to Rust's hundreds of kilobytes or something). However I can't judge what AI-written Rust code versus well-written Go code would come out as. AI is not terribly good at being concise (he said, while writing this post between prompts fighting with an AI to make a PR much more concise than it currently is).

▲ZiiS 7 hours ago | parent | prev | next [-]

You already can run the Go tsc in WASM using mature tools; but it further amplifies the memory and performance difference between the Rust version (which maps more cleanly onto WASM's design).

▲Tadpole9181 7 hours ago | parent | prev [-]

1. Porting typescript is made easier by the enormous test suite they can copy for verification.

2. They're doing this for workers, so with a systems-level language, there's a much higher potential for CPU and memory savings (an order of magnitude on this first pass, apparently). Driving their compute costs down is very revenue-efficient at this scale.

▲tgv 6 hours ago | parent [-]

For workers, you only need to strip the types. There's no need to do the expensive checking.

▲Tadpole9181 6 hours ago | parent [-]

Did you read TFA?

> Just a few weeks ago we announced supporting native Rust in Workers with the new Emscripten target for wasm-bindgen. When you run entire software build and deployment systems in tight loops on Workers, the benefits of a small memory footprint pay off quickly.

▲pier25 5 hours ago | parent | prev | next [-]

> Is the TS compiler unbearably slow?

It's not. Even the JS compiler is still fast enough for many projects given the single core improvements in hardware (eg Apple Silicon).

▲eterm 7 hours ago | parent | prev | next [-]

Faster feedback loops almost always deliver improvements elsewhere.

▲mohammedalfarra 7 hours ago | parent | prev | next [-]

[flagged]

▲kidby 7 hours ago | parent | prev [-]

[dead]

▲Rapzid 6 hours ago | parent | prev [-]

Up to 8x faster seems kinda of a crazy claim. 8x faster at what?! TS 7.0 is reasonably well optimized and compiles VSCode in well under 10 seconds..

This can type check and compile VSCode in less than a second?

▲lemagedurage 6 hours ago | parent | next [-]

For VSCode: 4x speedup vs TS 7, 3x vs TS 7.1

▲rs_rs_rs_rs_rs 6 hours ago | parent | prev [-]

Yes, it's in the article.

▲magicalist 6 hours ago | parent [-]

Well, no, not exactly. The article says vscode is compiled in 5.28s in typescript 7.1 (nightly), and in 1.73s in tsrs (dev), which is 3x faster.

▲Rapzid 6 hours ago | parent [-]

3x isn't so wild but still very impressive.