Hacker News new | ask | show | jobs
by suplexer 72 days ago
To all reasonable software developers out there, please don't listen to the prevailing groupthink. Javascript (the language) has many semantic problems but speed (from the VM) is one of it's best features! Like, you have to be writing some questionable code in very questionable styles/dialects to have a 10x (or more!) slowdown vs native.

Obviously - using native non-portable language/compiler features - you can reach some worthwhile speedup for certain workloads. But I have yet to see any of these "we rewrote our build system to Rust" type blog posts utilize any them.

It's always the apples-to-oranges marketing style drivel. Just because the some assertion comes from a very (very!) large company or well-known community member doesn't mean it is true.

In all my years of lurking this site, this port mortem is one of the few articles on this topic I trust: https://zaplib.com/docs/blog_post_mortem.html

This argument can also be applied to the separate, startup time performance axis. Though there are more tradeoffs there.

1 comments

Porting the TypeScript toolchain to Go made it 10 times faster:

https://devblogs.microsoft.com/typescript/typescript-native-...

Following by porting the CoPilot Runtime from TypeScript to Rust.

https://www.theregister.com/devops/2026/09/18/microsoft-agen...

I bet if you took the AI-generated Rust codebase and another 120k to reverse it right back to Typescript you'd get keep most of that same speed up!
Hardly given the limitation of V8 powering a dynamic language, it doesn't even match Java and .NET JIT compilers, as they have the benefit of actually using the type system for performance optimisations.

What makes node projects bearable, is that occasionally I have an excuse to write C++ Addons, or to fix something in one of those npm packages that is more native code than JS.

Java/.NET by default have an edge due to being less dynamic than JS and having a more mature VM. Both of these qualities are not static properties, as in: 1) You can programming JS in a style that is stricter than standard JS and even Java/C# 2) You can run JS on other virtual machines, including Hotspot VM (transpile to Java Bytecode)/GraalVM.

This stricter style js (asm.js) was the precursor to Webassembly; it still exists. You can also be very meticulous to craft monomorphic code through your project to get great performance.

Almost no one does this, cause it's harder, yet people still claim to know the limits of JS performance.

The AI Rust -> Typescript will provide the default structure V8 needs to run fast.

Yes you can, and the dynamic nature means it will still be slower than strongly typed languages.

Asm.js was a political decision from Mozzilla that never accepted PNaCL, and was never as fast as Chrome's solution, hence why we have WebAssembly nowadays.

I rather have AI Rust -> Machine Code / WebAssembly.

But why bother when you already have the speed up? And why didn't TypeScript deliver it in the first place?
I don't mean to say you should, I just wanna stress that it's important to be critical of claims others make without evidence.

Anyone can claim anything is true!

"But why bother when you already have the speed up? And why didn't TypeScript deliver it in the first place?"

That's a question for them.

As someone who is creating a serious programming language whose bootstrap compiler is currently in (a restricted form) of JS. I am immensely skeptical of their claim on all fronts.
Why are you skeptical of Anders Hejlsberg's claims about his own language? He designed TypeScript.

Are you claiming that your own, separate programming language is faster than TypeScript, just like Go is faster than TypeScript? So in fact you agree with Anders?

Yes, much faster. Conversely, I don't think Anders is claiming his Typescript implementation to be particularly fast - he believed JS wasn't fast enough to solve his performance problems. Which isn't true.

The TS compiler has always been slow. There are/were several TS-in-Rust/Go compilers long before Anders announced and released the offical Go version. I've also been writing transpilers since before TS was a thing, the TS team could have made it work in JS.

But it's often easier to switch to a language that gives you that structure/performance for free. "Free" in that large companies have the budget to afford a bug-for-bug port/rewrite.

Right, so you agree with him. TypeScript was too slow and switching to Go was the right choice.
Yes, only in that it's often easier to just rewrite it in a lower level language and be done. No, if you consider the time and effort for a bug-for-bug port.

They could have rewritten the Typescript compiler in better Typescript. I just peeked at random files in last TS compiler branch before the port (v6.0.3). Simply put, I would not have written it that way. That style would surely hit it performance cliffs.

If anyone from the TS team is lurking, I can be paid a reasonable consulting fee to talk lol. No free work from me, I'm already too busy with my own language.

Or contract me to match (or maybe even exceed) the Go port.

But I suspect Anders and the TS team are plenty satisfied with their Go port. So maybe, it'll be more of an educational adventure.