@tmikov
Tzvetan Mikov
9 months
Earlier I posted about Static Hermes compiling unannotated JS to Wasm. Attached are screenshots of the input and part of the output. Of course this is an ideal case, where we can infer all types. For regular code there would be many function calls, but it would still work.
Tweet media one
Tweet media two
3
4
57

Replies

@jamonholmgren
Jamon
9 months
@tmikov Could someone hypothetically build a VS Code extension that tells you when it can’t infer types and thus is doing it the slow way? function foo(bar) { ^^^ bar’s type is unable to be inferred, thus this function is not optimized // stuff } …etc
2
0
7
@tmikov
Tzvetan Mikov
9 months
@jamonholmgren It is possible, but not trivial. Emitting diagnostics like that is something that we have been thinking about, but have not implemented yet. But if you are worried about performance of a function, wouldn't it be easier to just add type annotations and not rely on inference?
1
0
6
@OrenMe
Oren Melamed
9 months
@tmikov This really reminds me of the early work of v8’s type info system by @fhinkel Although above is runtime but I guess the static Hermes means it does a run on compile and generates optimized code on top of it somehow
0
3
6
@tyroverby
Ty Overby
9 months
@tmikov If the JavaScript was limited to the “asm-js subset” then maybe it’s possible for big programs?
0
0
0