‹ BackHN Continuity

Thread

The JavaScript Midlife Crisis

56 points · 75 comments · maroun-baydoun

  1. msteffen · · focus · HN ↗
    Heterodox argument: a big part of the reason JavaScript has been so successful is that interpreted languages actually can be extremely fast—competitive with, and in many cases, faster than compiled languages, with V8 arguably the fastest interpreter in existence.

    See this post by Mike Pall, author of LuaJIT (which is comparable to or faster than V8 performance-wise, despite being basically a single-developer project), which explains why: <a href="https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180603053407&#x2F;http:&#x2F;&#x2F;article.gmane.org&#x2F;gmane.comp.lang.lua.general&#x2F;75426" rel="nofollow">https:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20180603053407&#x2F;http:&#x2F;&#x2F;article.gm.... Basically, it’s much easier to add high-quality runtime-trace-aware recompilation to a JIT interpreter, which a non-trace-aware compiled language will often not be able to beat.

    1. MiroslavPokorny · · focus · HN ↗
      Javascript only becomes fast because most of the CPU time is spent in native code rather than actual compiled or interpreted javascript.

      The big diff between scripted and compiled languages is the former dispatches by name and the later dispatches by index. No surprises which is faster and which can be compiled in the faster native code.

      1. jauntywundrkind · · focus · HN ↗
        JavaScript only becomes fast because it continually is making tradeoffs to decide what level of work to put into running any given bit of code. For a while this was three or four different targets on V8 (which I think maybe is down to just 2 now again).

        Compiled vs interpretted is viewing this through the compiled language lens. I think the interesting part is that some runtimes are dynamically deciding how to run the code. The contrast versus those folks who decide and bake every single decision in ahead of time, where the only thing that happens is totally pre-scripted, is strong.

        Stop Writing Dead Programs is such a lovely talk that hopefully can shake a couple of these sleepers awake, get us to see how absurd compiled code really is. And is quite fun and funnily said. <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=33270235">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=33270235

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.