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

I don’t have any experience with other languages, and I was surprised to see “Hello World” produces this big standalone executables in Node.js. Julia is not far off then.

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)
5 Likes

8.4KB

6 Likes

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

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

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.

6 Likes

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.

1 Like

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.

       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.

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

4 Likes

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

8 posts were split to a new topic: Do Garbage Collectors necessarily make code slow?

So twice the size of the executable from StaticCompiler.jl :wink:

3 Likes

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

Did you use the defaults, i.e. not all the tricks to reduce the size: Apps · PackageCompiler

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…

1 Like