PackageCompiler - size

I was playing with PackageCompiler. I managed to create shared and static libraries for a simple piece of code:

open("/tmp/borrame.txt", "w") do f
    write(f, "A, B, C, D\n")
end

f(x) = x < 20 ? true : false
print(f(3))
print(f(22))

I was surprised about the size 130M for the shared library.

Will it always be like that or is it a matter of time getting to more reasonable sizes?

I was playing with go and I just love how easy and fast it is to run go run file.go or compile go build file.go, getting a single file for the whole project. On the other hand it is really nice having a REPL.

Regards,
José M.

1 Like

What PackageCompiler does is it recompiles the Julia sysimg (sys.so) with your package/functions compiled on top. Since the Julia sysimg is about 130MB, that’s almost definitely what you’re seeing.

There is a branch of Julia in the works to potentially avoid the need to load the sysimg when we don’t want to pull in all that stuff, just to compile a simple (mostly static) binary: julia/test/standalone-aot at standalone-mode · tshort/julia · GitHub

Do note that using IO (print, open) requires libuv and the Task runtime, which itself might be rather heavy and hard to separate from the rest of libjulia without terribly breaking language symantics. I previously proposed having the option to replace libuv-provided IO with simpler libc-provided IO (which has very different but well-known semantics), which would be useful where you’re okay with blocking IO and such.

Thanks for the information. Really encouraging.