# Standalone "Hello World" Executable size comparison to Node.js

**URL:** <https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656>\
**Category:** Offtopic\
**Created:** [April 19, 2023, 1:08pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656 "2023-04-19T13:08:47Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![AMJ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amj/32/214096_2.png) [@AMJ](https://discourse.julialang.org/u/AMJ)\
**Post date:** [April 19, 2023, 1:08pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/1 "2023-04-19T13:08:47Z")

</div>

I don’t have any experience with other languages, and I was surprised to see “Hello World” produces [this](https://twitter.com/ThePrimeagen/status/1648419646100451330) big standalone executables in Node.js. Julia is not far off then.

---

<div class="post-metadata">

**Author:** ![woclass](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/woclass/32/212699_2.png) [@woclass](https://discourse.julialang.org/u/woclass)\
**Post date:** [April 19, 2023, 4:18pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/2 "2023-04-19T16:18:23Z")

</div>

`PackageCompiler.jl v2.1.5` + `julia 1.9.0-rc2` + `"Hello World!"`

- = 408 MB
- = 309 MB (julia 1.9) + 99 MB (sys.dll) + 76 KB (JuliaHello.exe)

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [April 19, 2023, 4:20pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/3 "2023-04-19T16:20:28Z")

</div>

> **[GitHub - tshort/StaticCompiler.jl: Compiles Julia code to a standalone...](https://github.com/tshort/StaticCompiler.jl#standalone-compilation)**
>
> Compiles Julia code to a standalone library (experimental) - GitHub - tshort/StaticCompiler.jl: Compiles Julia code to a standalone library (experimental)

`8.4KB`

---

<div class="post-metadata">

**Author:** ![AMJ](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amj/32/214096_2.png) [@AMJ](https://discourse.julialang.org/u/AMJ)\
**Post date:** [April 19, 2023, 7:33pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/4 "2023-04-19T19:33:16Z")

</div>

> [@woclass](#):
>
> `PackageCompiler.jl v2.1.5` + `julia 1.9.0-rc2` + `"Hello World!"`
> 
> - = 408 MB
> - = 309 MB (julia 1.9) + 99 MB (sys.dll) + 76 KB (JuliaHello.exe)

Hopefully will get there with attempts in 1.10 and more focus on this goal going onward.

> [@jling](#):
>
> 8.4KB

Yeah but we don’t get a lot of the language’s feature that way.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [April 22, 2023, 5:46pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/5 "2023-04-22T17:46:11Z")

</div>

What language features do you want for a program that just prints “Hello, world”? If you want a small executable you can get it, but then you don’t get the language runtime features (but you don’t need them). If you want all the language runtime features you can have those but that’s a big binary.

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [April 22, 2023, 5:58pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/6 "2023-04-22T17:58:40Z")

</div>

A program could take just those parts of the runtime that it uses, and help the programmer understand where in the program they’re requiring each feature.

---

<div class="post-metadata">

**Author:** ![FrancisKing](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/francisking/32/24966_2.png) [@FrancisKing](https://discourse.julialang.org/u/FrancisKing)\
**Post date:** [April 22, 2023, 7:46pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/7 "2023-04-22T19:46:19Z")

</div>

If we’re going to figure this out, we need to find a better example than “Hello, world”. There are a dozen languages that can do “Hello, world” better than Julia, including COBOL.

```julia
       IDENTIFICATION DIVISION.
       PROGRAM-ID. hello.
       PROCEDURE DIVISION.
           DISPLAY "Hello, world!".
           STOP RUN.

```

A simple compilation produces an executable of size 17 KB.

We need a more appropriate program.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [April 22, 2023, 8:45pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/8 "2023-04-22T20:45:16Z")

</div>

Not that it matters, but in what sense is that better?

---

<div class="post-metadata">

**Author:** ![Amval](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/amval/32/6217_2.png) [@Amval](https://discourse.julialang.org/u/Amval)\
**Post date:** [April 23, 2023, 7:20am UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/9 "2023-04-23T07:20:43Z")

</div>

More modern, user-friendly syntax, no doubt about it.

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [April 25, 2023, 2:36pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/10 "2023-04-25T14:36:22Z")

</div>

8 posts were split to a new topic: [Do Garbage Collectors necessarily make code slow?](https://discourse.julialang.org/t/do-garbage-collectors-necessarily-make-code-slow/97902)

---

<div class="post-metadata">

**Author:** ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)\
**Post date:** [April 24, 2023, 6:11pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/11 "2023-04-24T18:11:22Z")

</div>

> [@Do Garbage Collectors necessarily make code slow?](https://discourse.julialang.org/t/do-garbage-collectors-necessarily-make-code-slow/97902/1):
>
> Well, the executable only 17 KB, for starters.

So twice the size of the executable from StaticCompiler.jl 😉

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [April 24, 2023, 8:05pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/12 "2023-04-24T20:05:07Z")

</div>

Exactly. We can already make a smaller Hello world program than that from Julia and the program is considerably simpler.

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [April 25, 2023, 2:48pm UTC](https://discourse.julialang.org/t/standalone-hello-world-executable-size-comparison-to-node-js/97656/13 "2023-04-25T14:48:45Z")

</div>

Did you use the defaults, i.e. not all the tricks to reduce the size: [Apps · PackageCompiler](https://julialang.github.io/PackageCompiler.jl/stable/apps.html#Filtering-stdlibs)

> By default, all standard libraries are included in the sysimage. It is possible to only include those standard libraries that the project needs. This is done by passing the keyword argument filter\_stdlibs=true to create\_app. This causes the sysimage to be smaller, and possibly load faster. The reason this is not the default is that it is possible to “accidentally” depend on a standard library without it being reflected in the Project file.

You can e.g. drop LLVM too (at least for “hello world”). That should be increasingly better for 1.9; and use --compile=min for non-package code, to keep all language features, just miss out on the compiler at runtime…
