Re:Porffor: A from-scratch ahead-of-time JS engine
by fenomas on Tuesday July 30, 2024 @09:22PM
(#41115685)
Oh, I thought JIT in your comment meant a single compilation. Either way, having TS type guarantees would obviously make optimizing compilers like v8's stronger, right? You seem to be arguing there's no value to it, and I don't follow that.
[ Parent
| on HN ]
Re:Porffor: A from-scratch ahead-of-time JS engine
by wk_end on Tuesday July 30, 2024 @11:52PM
(#41116282)
My claim is that the guarantees that TS provides aren't strong enough to help a compiler produce stronger optimizations. Types don't just magically make code faster - there's specific reasons why they can make code faster, and TypeScript's type system wasn't designed around those reasons.
A compiler might be able to wring some things out of it (I'm skeptical about obviouslynotme's suggestions in a cousin comment, but they seem insistent) or suppress some checks if you're happy with a segfault when someone did a cast...but it's just not a type system like, say, C's, which is more rigid and thus gives the compiler more to work with.