8 comments

  • dcre1 hour ago
    I was curious why bun build --compile would be faster. The docs say:<p>“Compiled executables reduce memory usage and improve Bun’s start time.<p>Normally, Bun reads and transpiles JavaScript and TypeScript files on import and require. This is part of what makes so much of Bun “just work”, but it’s not free. It costs time and memory to read files from disk, resolve file paths, parse, transpile, and print source code.<p>With compiled executables, you can move that cost from runtime to build-time.”<p><a href="https:&#x2F;&#x2F;bun.com&#x2F;docs&#x2F;bundler&#x2F;executables#deploying-to-production" rel="nofollow">https:&#x2F;&#x2F;bun.com&#x2F;docs&#x2F;bundler&#x2F;executables#deploying-to-produc...</a>
  • mdavid6266 minutes ago
    Yeah, right. Replaced sqlite with in memory map. Whoa.. it’s faster now.
  • ksec1 hour ago
    &gt;Next: the runtime itself. Bun has a bun build --compile flag that produces a single self-contained executable. No runtime, no node_modules, no source files needed in the container.<p>I didn&#x27;t know that. So Bun is basically a whole runtime + framework all in one with little to no deployment headaches?
    • thewarman1 hour ago
      This (single executable) is available in node.js now too as SEA mode.
      • claytongulick36 minutes ago
        But I think it still doesn&#x27;t work with ESM, only CommonJS, so while not insurmountable, not as good as bun.
        • williamstein20 minutes ago
          SEA with node.js &quot;works&quot; for nearly arbitrarily general node code -- pretty much anything you can run with node. However you may have to put in substantial extra effort, e.g., using [1], and possibly more work (e.g., copying assets out or using a virtual file system).<p>[1] <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@vercel&#x2F;ncc" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;@vercel&#x2F;ncc</a>
    • jamsinclair1 hour ago
      The bun build creates a large self-contained executable with no optimisations. Almost like a large electron build.<p>Deno also provides the same functionality, but with a smaller optimized binary.<p>Appreciate Bun helping creating healthy competition. I feel like Deno falls under most people&#x27;s radar often. More security options, faster than Node, built on web standards.
      • matorl9 minutes ago
        Deno&#x27;s security options are very useful for AI sandboxes. Broader than node&#x27;s permissions. Bun badly needs the same.<p>There&#x27;s a PR for Bun that gives the same security but it&#x27;s been sitting for months <a href="https:&#x2F;&#x2F;github.com&#x2F;oven-sh&#x2F;bun&#x2F;pull&#x2F;25911" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;oven-sh&#x2F;bun&#x2F;pull&#x2F;25911</a><p>I want to migrate an existing project to Bun but cannot until it has a security permission system in place.
  • abustamam1 hour ago
    I use bun for everything except for monorepos with isolated deployment targets and shared packages. I use yarn or pnpm for monorepos. Maybe it&#x27;s changed in the last six months but I could never get docker to properly resolve my dependencies when I only want to build the web app, for example, since the bun lock is deterministic based off of all the packages in the repo so isolating a single leaf makes it error.<p>Maybe I&#x27;m doing something wrong but I scoured docs and online and asked multiple AI agents to no avail.
  • azinman219 minutes ago
    So is Bun saying that JSC is much better than v8?
    • carefree-bob16 minutes ago
      It&#x27;s more that Zig is faster than JS. The speed advantages of Bun come from all the Zig bindings, not the JS interpreter.
  • denys_potapov1 hour ago
    tl;dr replace SQLite with Map ~ 2x speed up, replace zod validation with ifs ~ 2x speed up. Bun had a memory leak on unresolved promises - now fixed
  • LeonTing10101 hour ago
    [flagged]
  • mememememememo25 minutes ago
    How much would you get by moving to Go, Rust or C++?