5 ms·
Apparently a hello world is like 90MB. https://twitter.com/jarredsumner/status/1657765876085690368 https://twitter.com/jarredsumner/status/1657765876085690368
by pier25 3y ago
Apparently a hello world is like 90MB.
https://twitter.com/jarredsumner/status/1657765876085690368 https://twitter.com/jarredsumner/status/1657765876085690368
- bryancoxwell 3y agoWell, I do appreciate the transparency to be honest.
- VWWHFSfQ 3y agoI'm curious why that would be so big. Even my python3.10 binary + /usr/lib/python3.10 is only 30MB
- matlin 3y agoIt bundles an entire JS engine with it. I think JSC in Bun's case. V8 for Deno and Node.
- ricardobeat 3y agoThe engine is not the largest part of it. just-js, which is pretty close to barebones V8, sits at ~20MB. JSC is supposed to be about 4MB, Hermes is 2-3MB. The largest parts I think are ICU and the built-in libraries.
- billywhizz 3y agoyes. author of just-js here. a minimal build of a v8 based runtime weighs in around 23-25 MB on modern linux using latest v8. this gets bigger all the time, due to new functionality being added to JS/V8 and no easy way to decide what parts of JS to include. when i started working on just-js ~3.5 years ago i'm pretty sure it was only 15MB or so - can verify when i have time.
- billywhizz 3y agoi just tried recompiling v0.0.2 (https://github.com/just-js/just/releases/tag/0.0.2 https://github.com/just-js/just/releases/tag/0.0.2) of just-js and comparing it to current. for the completely static build on ubuntu 22.04 i see following: 0.0.2 (v8 v8.4.371.18) - file size: 15.2 MB, startup RSS: 8.4 MB current (v8 v10.6.194.9) - file size: 19.5 MB, startup RSS: 12.3 MB so, that's roughly 30% binary size increase and 50% greater startup memory usage in 2.5 years. =/
- leeoniya 3y agoICU :( https://github.com/oven-sh/bun/issues/2541 https://github.com/oven-sh/bun/issues/2541 https://twitter.com/jarredsumner/status/1616597667408404481 https://twitter.com/jarredsumner/status/1616597667408404481
- edflsafoiewq 3y agoQuickJS has a custom unicode library for this reason.
- mananaysiempre 3y agoIt’s slow as molasses in some parts though. (Deliberately, it’s a trade-off.) The Unicode part of ICU shouldn’t be that large, however (on the order of hundreds of kilobytes), it’s the locale data that’s big[1]. Does Bun implement ECMA-402 internationalization? Even without locales, one of the largest parts of ICU data is normalization and casing tables, which I think bare ECMAScript does not require. (It does mean bare ECMAScript cannot adequately process Unicode text, but meh, you get what you pay for.) [1] https://unicode-org.github.io/icu/userguide/icu_data/buildtool.html#file-slicing-coarse-grained-features https://unicode-org.github.io/icu/userguide/icu_data/buildto...
- sjrd 3y agoBare ECMAScript does require normalization [1] and case conversions (for the root locale only) [2]. [1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... [2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toLowerCase https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
- mananaysiempre 3y agoAh, I see, String.prototype.normalize() is in ES6. I remembered that Duktape (which has its own, even slower Unicode library) can’t do it[1], but then it doesn’t try for ES6 either. [1] https://github.com/svaarala/duktape/issues/1718 https://github.com/svaarala/duktape/issues/1718
- paulddraper 3y agoIIRC the latest Linux Node.js binary is over 70MB. Though Bun doesn't use Node.js I believe, there's a reference (At least it's not JVM Hotspot...)
- U1F984 3y agoA Java Runtime for Hello world is just 32 MB: https://adoptium.net/blog/2021/10/jlink-to-produce-own-runtime/ https://adoptium.net/blog/2021/10/jlink-to-produce-own-runti...
- paulddraper 3y agoA full Java runtime is 95MB. (Smaller than the JDK size of 312MB.) > The jlinked runtime using the above command is about 95Mb. Simple programs -- like Hello World -- can indeed exclude certain parts of the JRE using jdeps, for a smaller size.
- mike_hearn 3y agoYou can actually get it smaller if you compile your own JDK and look at the compressed size. I got it down to 7mb at one point.
- datavirtue 3y agoThat small!?
- pseudosavant 3y agoIs 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.
- pier25 3y agoDepends. 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.
- metaltyphoon 3y agoYeah but no one distributes hello world.
- georgyo 3y agoIf the base line is 90MB, then it only goes up from there.
- patrickthebold 3y agoThe 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.
- kaba0 3y agoA 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.
- keyle 3y agoyeah 90MB for a hello world is big. Approximately 2,700 times bigger than it could be.
- s17n 3y agoFor most use cases, that doesn’t matter.
- stephc_int13 3y agoThe storage part is not a big deal, it does not look nice but this is simply a bit disgusting. The worrying part is that this is mostly code, not dead junk simply occupying space, this is part of the code path, filling the caches, or should I say trashing the caches…