I mean, sure, that’s probably heavily influenced by the need for bundling for the frontend.

But it isn’t done blindly. Bundlers reduce the overall size of the code, either due to minification or tree-shaking (removing unused modules). It also removes the filesystem overhead of resolving and opening other modules.

Would bundling be useful in other interpreted languages?

I suppose you may count JVM’s compilation to bytecode as being very similar.

  • palebluethought@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    1 year ago

    The size of the code is mostly irrelevant if you’re not shipping it to clients over the network on every request. Short of truly gargantuan statically-linked binaries in compiled languages, anyway, and bundling isn’t really an applicable concept there. And similarly, the overhead of loading modules from the filesystem is a one-time cost that’s mostly irrelevant for server-side code that runs for days or weeks or years at a time.

    On the other hand, the complexity overhead of adding the additional bundling step is a major drag on development productivity, debuggability, etc.

    • Cyclohexane@lemmy.mlOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      The size of the code still impacts your deployment. Moreover, if you’re using something like AWS lambda, small changes can have significant influence on cold start time.

      I agree that an extra step is not desirable, but this would only be done for production deployments (and consequently pre-prod if you do that).

      • palebluethought@lemmy.world
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        1 year ago

        Lambda is certainly an interesting case for this, I’ll give you that. Outside of that, though, the impact on deployment speed is also not relevant; the bottlenecks for deployment are things like CI, canarying, even rolling blackout windows across AZs, etc. The actual time spent transmitting your build artifact over the network is completely negligible even at huge sizes

  • JackbyDev@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I guess it boils down to if bundling can improve execution speed. On the web it would make page loads quicker.

    • Cyclohexane@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      In nodejs, at least, it does. The minification and tree-shaking can make code significantly smaller. This can mean smaller cold start time in AWS Lambda for example, or just overall a little less RAM. If your heap isn’t that large, that can be noticeable.

      It also eliminates the filesystem overhead of resolving and loading modules.