tshort / StaticCompiler.jl

Compiles Julia code to a standalone library (experimental)
Other
488 stars 31 forks source link

Binary doubled in size #129

Open PallHaraldsson opened 1 year ago

PallHaraldsson commented 1 year ago

In in example docs (used the code there):

shell> ls -alh hello
-rwxrwxr-x. 1 user user 8.4K Oct 20 20:36 hello

in my case:
shell> ls -alh hello
-rwxrwxr-x 1 pharaldsson pharaldsson 16K maí 19 16:39 hello

Is it known why? I used 1.9.0, the possible reason?

brenhinkeller commented 1 year ago

So I think this varies somewhat widely as a function of OS and architecture. That example was run on an intel mac; linux gave slightly larger binaries IIRC, and on my current arm mac the same example weighs in at 33k. It's possible that binary size also changed as a function of something in this package, but one would have to run a systematic comparison to be sure.

If we generally want to prioritize binary size, there are likely compiler flags we could specify on e.g. this line https://github.com/tshort/StaticCompiler.jl/blob/51db924b140593cb31aea1f386e139940a1402ea/src/StaticCompiler.jl#L497or via the cflags kwarg. If you want to experiment with this it could be a nice thing to add to the docs!

PallHaraldsson commented 1 year ago

I can look into it a bit. It's not a huge priority to me or anyone, likely a fixed overhead.