• mbtrhcs@feddit.org
    link
    fedilink
    arrow-up
    1
    ·
    2 days ago

    Only if you choose a lower language level as the target. Given these results I suspect the researchers had it output JS for something like ES5, meaning a bunch of polyfills for old browsers that they didn’t include in the JS-native implementation…

      • mbtrhcs@feddit.org
        link
        fedilink
        arrow-up
        1
        ·
        19 hours ago

        Yeah sure, you found the one notorious TypeScript feature that actually emits code, but a) this feature is recommended against and not used much to my knowledge and, more importantly, b) you cannot tell me that you genuinely believe the use of TypeScript enums – which generate extra function calls for a very limited number of operations – will 5x the energy consumption of the entire program.

        • TCB13@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          14 hours ago

          This isn’t true, there are other features that “emit code”, that includes: namespaces, decorators and some cases even async / await (when targeting ES5 or ES6).