3 ms·
The reason most JavaScript engines do it is because they have three or four ways of executing code that are all intended to offer maximal performance under diff
by astrodust 10y ago
The reason most JavaScript engines do it is because they have three or four ways of executing code that are all intended to offer maximal performance under different circumstances. If it takes longer to compile a function than to simply interpret it, don't bother compiling. If it's called frequently, compile it.
Your academic view of compilers work has no bearing on how ugly and complicated reality is.
- kazinator 10y ago> Your academic view of compilers work ... I didn't write anything about compilers. Scanning tokens isn't compiling. Even old line number BASIC in 1981 running on 1Mhz computers with 32Kb RAM at tokenized code as it was entered into memory.
- astrodust 10y agoThe JavaScript VM is a lot more complicated than a compiler, it's a compiler, an interpreter, and a whole heap of hacks to squeeze maximal performance out of it. That there's a problem processing whitespace isn't a reflection on the team not knowing their stuff, it's a problem that will be corrected. It's likely something that was never benchmarked and proven to be an issue before, or if it was an issue it was a low-priority one.