News for hackers. Stuff that matters.
Re:A 10x Faster TypeScript by sebzim4500 on Tuesday March 11, 2025 @03:42PM (#43336285)
How do you reconcile this view with the fact that the typescript team rewrote the compiler in Go and it got 10x faster? Do you think that they could have kept in in typescript and achieved similar performance but they didn't for some reason?
Re:A 10x Faster TypeScript by austin-cheney on Tuesday March 11, 2025 @05:13PM (#43337062)
I have no idea about the details of their test cases. If they had used an even faster language like Cobol or Fortran maybe they could have gotten it 1,000,000x faster.

What I do know is that some people complain about long compile times in their code that can last up to 10 minutes. I had a personal application that was greater than 60k lines of code and the tsc compiler would compile it in about 13 seconds on my super old computer. SWC would compile it in about 2.5 seconds. This tells me the far greater opportunity for performance improvement is not in modifying the compiler but in modifying the application instance.

Re:A 10x Faster TypeScript by zombot on Wednesday March 12, 2025 @03:42AM (#43340753)
> maybe they could have gotten it 1,000,000x faster.

WTF.

Re:A 10x Faster TypeScript by flykespice on Wednesday March 12, 2025 @10:14AM (#43343466)
Yeah this is an overly exaggerated claim
Re:A 10x Faster TypeScript by zombot on Thursday March 13, 2025 @02:02AM (#43350736)
It was unwarranted sarcastic snark. That commenter was bitten by some bug.
Re:A 10x Faster TypeScript by auxiliarymoose on Tuesday March 11, 2025 @06:56PM (#43338001)
This was touched on in the video a little bit—essentially, the TypeScript codebase has a lot of polymorphic function calls, and so is generally hard to JIT optimize. JS to Go therefore yielded a direct ~3.5x improvement.

The rest of the 10x comes from multi-threading, which wasn't possible to do in a simple way in the JS compiler (efficient multithreading while writing idiomatic code is hard in JS).

JavaScript is very fast for single-threaded programs with monomorphic functions, but in the TypeScript compiler's case, the polymorphic functions and opportunity for parallelization mean that Go is substantially faster while keeping the same overall program structure.