2 ms·
> parse the text slightly differently depending on if it is being inlined or not Any frosh should recognize that as a language design/implementation smell by t
by kazinator 10y ago
> parse the text slightly differently depending on if it is being inlined or not
Any frosh should recognize that as a language design/implementation smell by their third year.
> most javascript engines do this
That somehow falls short of being convincing that it's right.
- Klathmon 10y agoYou can say how it's design smell all you want, but do you have any reasons why? This is a JIT, optimizations like this can (and do) have some pretty big impacts on the speed of the execution without needing a long warmup which is extremely important for a language like javsacript. And in doing so it needs to balance battery usage, startup performance, "hot" performance, and a ton of other things. Its easy for you to stand back and say "that's dumb", but optimizations are often messy, and without them the language would run much slower. > That somehow falls short of being convincing that it's right. That's why I tried to provide other reasons why I think it's right...
- astrodust 10y agoThe 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.