Remix.run Logo
cornholio 3 hours ago

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.

nielsbot 2 hours ago | parent | next [-]

Why don't JITs preserve previous work across runs of the same code?

If you encounter code with the same hash as last time, load up the previously generated binary and run that... or is that already happening?

mirekrusin 2 hours ago | parent | prev [-]

Julia?

cornholio 2 hours ago | parent [-]

That's a JIT. Yes, you can do all sorts of optimizations in a JIT, because you do it at runtime using runtime information, and always keeping an escape hatch, so the static code bails when invoked with data it was not compiled to handle. This kind of hatch is used here with <any> wrapping.

JIT is a technique to accelerate dynamic languages at runtime to near machine performance while keeping dynamic ergonomics; but it can't transcend the AOT / runtime wall.