logoalt Hacker News

Dylan16807today at 4:36 AM2 repliesview on HN

I think you mean you can't get that performance without monomorphization. When you know the types you can...

...wait, I went and looked up that file.

"The Three Optimizations That Would Close the Gap"

You're presenting the data from there in an extremely misleading way! They in no way need to drop any Typescript semantics to go faster.


Replies

cornholiotoday at 5:26 AM

Typescript is a dynamic language. Without changing the language, there is fundamentaly no way to resolve at compile time decisions that can be made only at runtime (ie, they are data driven). Monomorphization helps pin down (some) dynamic types but the fundamental problem remains.

show 2 replies
madanparastoday at 5:15 AM

You're right. The typed buffer locals optimization keeps TypeScript semantics intact by exploiting the existing Buffer/Uint8Array type annotation to skip the NaN-unbox. It's not dropping types, it's using them. The floor I described applies to any-typed paths where static type info isn't available. For well-typed TypeScript, the roadmap shows the gap closes without semantic changes.

show 1 reply