Hacker News new | past | comments | ask | show | jobs | submit login

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.



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.


PyInstaller actually seems to have less overhead, in terms of space, not "much much more". Building a hello world script with "pyinstaller --onefile" gives me a 5.6 MB executable on Linux or 4.9 MB on Windows.


A leaned up JRE (only containing the base jdk classes) and an included hello world is 47.2MB.


“The generated file is 7.7MB, which is quite impressive for a Java application since this executable does need a JVM.”

I assume this is a typo and they mean “does NOT”?


I think it isn't, and there saying it's impressive how small the JVM overhead is.


Is the JVM inside that 8MB then I guess? That is pretty great.

Originally I thought the alternative was “8MB but supply your own virtual machine.”


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 under 2KB pretty easily. Smaller than the equivalent C program. But of course, that's not including the size of your system JVM.


> 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 executables still have a Java runtime embedded into them (called Substrate VM, by the way), making them very different from C (much more like Go).

Also,notice that native Java executables still tend to have a lower "peak performance" (i.e. once a "normal" JVM has warmed up, it will almost certainly be faster than a native executable because the latter cannot do JIT compilation to take advantage of runtime profiling, like a normal JVM does).


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."


That's not at all comparable.

From your link:

"Most of the routines in libgcc handle arithmetic operations that the target processor cannot perform directly."

You're trying to imply the Java native runtime is comparable to liggcc?? That's silly.


A runtime is a runtime, regardless of the size and features checkbook.


I think the point was that it's a matter of degree and not of substance


The hello world .class file is 413 bytes, just as an info.


Thanks, smaller than I remembered. Been a while since I've done any Java so I aimed a little high.


A full Quarkus web application with REST uses just 12MB of RAM (with Graalvm). So yes, Java has come a long way


Part of that I imagine is the same problem deno has.

ICU locale data is pretty hefty and there aren't says to trim it down.



Depends. Doesn't seem much for a server but if you want to distribute an executable to your users then 90MB seems huge. IIRC a hello world Go binary is like 2MB.


Yeah but no one distributes hello world.


If the base line is 90MB, then it only goes up from there.


The question is "how fast". If bun executables are always 45x go's that's a problem. If they are always 98mb more than go's, then it's less of a problem as the size grows.


A car that can transport 7 people is not 3.5x heavier than a car that can only have place for two — the initial size is much bigger, additional js code won’t bloat it further that much.


Python's embeddable package for Windows [1] is 16 MB unpacked.

The OpenJDK runtime with the java.base and java.desktop modules is 64 MB. Replacing Swing with SWT (leaving out the java.desktop module) gets it below 50 MB. The full OpenJDK runtime with all modules is around 128 MB. (With Java 17 on Windows.)

[1] https://docs.python.org/3/using/windows.html#windows-embedda...


yeah 90MB for a hello world is big.

Approximately 2,700 times bigger than it could be.


I got 4Gigs on my phone and 4x that on my laptop. I don't care about 90megs.

What's the point in looking at size ? I can see two:

- want to email the exe, and you have limits on mail size - want to be ecofriendly, in that case stop watching netflix for 2 hours and you'll have your megs


The demo of Quake II, contained 3 fully playable levels, and is 11 MB.


I see it differently, what if I want to have more than 40 apps on my phone?

Although, to be fair it seems likely the executable size will shrink with time.


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.


Sure but then we're loosing the simplicity advantage of having only a single executable right?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: