|
|
|
|
|
by ridiculous_fish
2687 days ago
|
|
Modern JS engines rely on tracing JITs to achieve good performance. These optimizations only kick in once code has executed multiple times. But a lot of JS code executes only once, such as layout code running at app launch. Heck, lots of JS code executes zero times. This code still imposes a cost (parsing, etc). Consider the complaints about app launch time of Electron apps. A static compiler can be more effective at the runs-once or runs-zero cases. |
|
The difference is that you compile user control flow as-is unless you have overwhelming evidence that you should do otherwise.
And yes you are right. This is promising for run-once code, but all of the cost will be in dynamic things like the envGet. An interpreter can actually do better here because most environment resolution can be done as part of bytecode generation. So it’s possible that this experiment leads to something that is slower than JSC’s interpreter.