111 points hnisjafx40 2 hours ago 61 comments
AbuAssar 1 hour ago | parent
Microsoft should seriously consider porting typescript to rust at this point
ndr 1 hour ago | parent
IIRC at the time of the port to go they wanted fast test and compile time, of course it's a different era now.
lemagedurage 10 minutes ago | parent
tgv 1 hour ago | parent
eterm 1 hour ago | parent
TheMrZZ 1 hour ago | parent
Also, faster feedback loop is crucial for AIs, so I guess this makes sense.
pjmlp 1 hour ago | parent
Don't rewrite into Rust, Go, Java, .NET, Zig, Odin, whatever.
Start with them directly.
ruther4d 1 hour ago | parent
msdz 1 hour ago | parent
Why not vibecode a Go -> WASM cross-compiler, then?
AbuAssar 1 hour ago | parent
msdz 1 hour ago | parent
jerf 54 minutes ago | parent
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).
Lvl999Noob 1 hour ago | parent
zamalek 1 hour ago | parent
Tadpole9181 51 minutes ago | parent
ZiiS 58 minutes ago | parent
Tadpole9181 53 minutes ago | parent
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 36 minutes ago | parent
Tadpole9181 30 minutes ago | parent
> 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.
aleksandrm 48 minutes ago | parent
Rapzid 37 minutes ago | parent
This can type check and compile VSCode in less than a second?
lemagedurage 13 minutes ago | parent
retropragma 1 hour ago | parent
egonschiele 1 hour ago | parent
> However, frontier AI models can now do large-scale ports almost independently in a matter of days
> I wrote zero code. Not "barely any". Zero
So we are going to move from a carefully handwritten port to an entirely AI-generated port. I know this is the way the industry is headed, I use coding agents a ton. But I still review their output because they often don't make sound architectural decisions. Maybe this is a sign that my way of working is going away. I'm not sure how to justify that kind of time spent when someone can do the same thing in a matter of days with barely any effort.
I am working on my own language now, I've spent most of this year on it. The idea that someone could just replace it in a matter of days is wild. Wonder how the TS team at Microsoft feels about this.
TheSamFischer 1 hour ago | parent
They didn’t design a language that millions of human engineers enjoy (?, lol) using. They took an existing codebase and ported it. Yes, the porting part is easier now but only because another project and spec exist.
egonschiele 54 minutes ago | parent
FuckButtons 38 minutes ago | parent
TheSamFischer 12 minutes ago | parent
onlyrealcuzzo 58 minutes ago | parent
You do have to be worried that it's possibly installing trojan horses on your computer while compiling code, or any other number of unwanted side effects.
But you can and should be able to have integration testing in place to know that a compiler - at a minimum - actually works.
egonschiele 52 minutes ago | parent
wannabe44 1 hour ago | parent
frangonf 1 hour ago | parent
norman784 1 hour ago | parent
nsm 1 hour ago | parent
You almost definitely don't need to immediately plan to switch.
cryptonym 47 minutes ago | parent
True. Looks like main use-case is AI Agent Sandboxing
sheepscreek 52 minutes ago | parent
It wasn’t “let’s build a faster Rust based Typescript compiler” at all. That was a nice side-effect.
They needed a Typescript compiler that can run on their WASM only sandbox. So the only existing option was to export tsc Go to WASM, but that comes with the full Go runtime.
And to avoid that cost, they experimented with a Rust compiler and turns out it’s even faster than the reference tsc/Go implementation.
nalekberov 50 minutes ago | parent
DanRosenwasser 34 minutes ago | parent
We think the wasm and oxlint integration makes a lot of sense for Cloudflare's needs, so this investment makes sense. At the same time, we'll be working hard and collaborating to make the official TypeScript toolset faster and even more efficient.
Congrats to the tsrs team on making this official. We're excited and we look forward to continuing on collaboration!
egonschiele 29 minutes ago | parent
samuelstros 18 minutes ago | parent
No matter how many optimizations can be ported from tsrs to ts-go, Rust will be more efficient and enable the WASM use case.
The premise of porting the compiler from TS to GO was ease of migration due to Go's garbage collector. That doesn't hold anymore? AI doesn't care how hard or easy a migration is if a test suite exists.
lemagedurage 17 minutes ago | parent
Could you elaborate on what type of optimizations were added to TS 7.1? As in, were they more algorithmic or related to memory management?
afdbcreid 29 minutes ago | parent
Essentially, they fake a GC via never-freed arenas for long-living objects. It's interesting that Rust can do that (hopefully soundly)!
zamalek 14 minutes ago | parent
>Create with P::new(value). p.get() returns &'static T. [...] unless an explicit recycling site proves them dead
It's unsound, the LLM/human is doing the proving. They've hidden unsafe in an abstraction without removing the unsafeness. Using the arena allocator's lifetime would have been safe and easy (bumpalo recommends this AFAIK).
I'm guessing a sycophantic LLM either found or praised this load-bearing seam.
gzapp 28 minutes ago | parent
jscheel 9 minutes ago | parent