Live data from Hacker News

Bun 0.6

bun.sh

191–200 of 243 posts

Re: Bun 0.6

#191
post #81

Earlier quoted context omitted.

Apparently a hello world is like 90MB. https://twitter.com/jarredsumner/status/1657765876085690368

Is 90MB really that big when compared against the other types of binaries that would get deployed: containers and VM images? How big is the platform (k8s, docker, etc) you need installed to run your app? Probably more than 90MB.

[deleted]

Re: Bun 0.6

#192
post #46
post #42

Earlier quoted context omitted.

And NodeJS too https://nodejs.org/api/single-executable-applications.html

There is also https://github.com/vercel/pkg

Does anyone know of a good comparison of these bundling methods?

Re: Bun 0.6

#193
post #81

Earlier quoted context omitted.

Apparently a hello world is like 90MB. https://twitter.com/jarredsumner/status/1657765876085690368

Is 90MB really that big when compared against the other types of binaries that would get deployed: containers and VM images? How big is the platform (k8s, docker, etc) you need installed to run your app? Probably more than 90MB.

I have 13043 .exe files on this computer, at 90MB a piece that would be 1TB.

Re: Bun 0.6

#194
post #180

Earlier quoted context omitted.

A native Java "Hello World" can be around 8MB in size.[1] So, yes, 90MB is too much. 1. https://sergiomartinrubio.com/articles/getting-started-with-...

I feel like using Graal for the comparison is cheating a bit because it's so fundamentally different from what bun is doing. You need to compare it to tools that ship class files and a JVM, or something like PyInstaller which will have much much more overhead.

I wouldn’t call it cheating.

I’d also compare against stripped Rust binaries statically linked against musl.

Re: Bun 0.6

#195
post #71
post #48

Earlier quoted context omitted.

Nah, rust still depends on libc at runtime which is a pain. Go doesn't have this problem afaik as it has its own stdlib and runtime.

You can statically link libc in Rust too; at least, if teh interwebz is correct (not a Rust expert); you just need some extra flags. This is actually not that different from Go in practice; many Go binaries are linked to libc: it happens as soon as you or a dependency imports the very commonly used "net" package unless you specifically set CGO_ENABLED=0, -tags=netgo, or use -extldflags=-static.

You can, but usually, if you really want a binary with no runtime dependencies, most people will just compile their code against musl libc instead.

The only issue is that some lib sometime do not compile (or at least without some workaround) with musl. Although it often concern one specific platform (looking at you Mac OS).

Re: Bun 0.6

#196
post #6

> Standalone executables. You can now create standalone executables with bun build. > bun build --compile ./foo.ts > This lets you distribute your app as a single executable file, without requiring users to install Bun. > ./foo This is big! Part of Go's popularity is due to how easy it is to produce self-contained executables. And it seems to support amd64 and arm according too: https://twitter.com/jarredsumner/statu…

Yeah, because compilers that produce static binaries don't exist since Macro Assemblers and FORTRAN were created. /s

Re: Bun 0.6

#197
post #48

Earlier quoted context omitted.

> Part of Go's popularity is due to how easy it is to produce self-contained executables. Rust too... :D

Nah, rust still depends on libc at runtime which is a pain. Go doesn't have this problem afaik as it has its own stdlib and runtime.

Not always, because some platforms require you to use their libc.

Re: Bun 0.6

#198
post #190

Earlier quoted context omitted.

There's no JVM when using GraalVM Native Images, it relies on a JVM during the compile step (well, specifically GraalVM), but produces native code similar to compiling C. There's no virtual machine running bytecode, just entirely native code. So the size of the executable will depend on how many features of the JVM you need compiled into your executable. A pure java bytecode (bring-your-own-JVM) Hello World can be un…

> but produces native code similar to compiling C. That's very misleading. For one, Java running native still needs a Garbage Collector, maintains Object headers which increase memory usage, can do things like reflection for configured classes, can load services via the ServiceLoader, schedule Threads and manage executors, and many other things that are "expected" to any Java application... in summary: native executa…

It also misleading to think C doesn't have a runtime.

https://learn.microsoft.com/en-us/cpp/c-runtime-library/c-ru...

https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html

https://software-dl.ti.com/codegen/docs/tiarmclang/compiler_...

And many more, not feeling like linking documentation from all C compilers.

In fact this is so relevant even for C, that ISO C has a special section for deployments without runtime support, named freestanding C.

"In a freestanding environment (in which C program execution may take place without any benefit of an operating system), the name and type of the function called at program startup are implementation-defined. There are otherwise no reserved external identitiers. Any library facilities available to a freestanding propram are implementation-defined."

Re: Bun 0.6

#199

Earlier quoted context omitted.

It wouldn't exist any other way, the story is that it was built with speed as a priority, and Zig was chosen for the performance optimizations it enables.

There are several other languages that could achieve the same speed and performance optimizations. To be clear, I hope to see Zig succeed and I'd like to learn it one day. It reminds me of the video game engine question, only in this case it would be: do you want to build a product, or do you want to build something with Zig? I imagine the creators of Bun answered "we want to use Zig" as their first priority, and tha…

At one point, the Rust team switched away from the performant Jemalloc allocator to something more widely compatible (the system default). They chose to sacrifice performance in the sake of compatibility/stability. It's still available, but optional.

https://internals.rust-lang.org/t/jemalloc-was-just-removed-...

Insane performance gains, like the ones we see early in Zig, is something that can be easily eaten away by the natural evolution and maturity of a programming language.

Btw, Zig is beating trees with a stick to see what may fall down in this area: https://github.com/ziglang/zig/issues/12484

Re: Bun 0.6

#200
post #193

Earlier quoted context omitted.

Is 90MB really that big when compared against the other types of binaries that would get deployed: containers and VM images? How big is the platform (k8s, docker, etc) you need installed to run your app? Probably more than 90MB.

I have 13043 .exe files on this computer, at 90MB a piece that would be 1TB.

If most executables on your machine used Bun, then it would be a bundled shared library on your system eliminating the bulk of the 90mb executable size. Just like the shared libraries the 13043 .exe files on your computer are currently linking to.
Post reply on HN