Julia static compilation

question

#19

@joaquimg, to 3: Why do you think generating execs is not a way to hide proprietary code? (I would like to understand your point)


#20

I said:

Firstly, because I am not even close to a specialist in the matter, so I will tell you what I know, that might be imprecise or sometimes wrong.

Given a executable one can extract assembly code, and even convert to C… It will result in a messy code.

Many of the ways people use to put python and R code into execs do not generate assembly code they simply hide the script, so its usually possible to extract the script completely (including comments!). Thus the right thing to do in this case e just code obfuscation and that has nothing to do with static compilation, its just some kind of indirect consequence for languages like C.

I am not sure about the julia process, someone else might it explain and even correct me in whatever mistake I might have made above.

But the 3 topics I presented are independent and people do mix them when talking about static compilation:

  1. remove JIT overhead
  2. make a program more compact easier to distribute
  3. obfuscating the code

In particular, I am more interested in 1 and a little bit in 2 (that can be partially solved by BuildExecutable.jl and the userimg.jl method). 3 might me solved by some routines of replacing words, spacing, tabs, comments etc.


#21

I’m specifically interested in the static compile with minimal runtime usecase. Anyone have any idea how far out that is? 1.0 or post 1.0?


#22

for 3) I have created an issue here:

  1. is actually a pretty nature thing in context of package precompilation, see:
    https://github.com/JuliaLang/julia/issues/16330

#23

Ability to make proprietary packages is absolutely mandatory for further language adaptation.


#24

While I personally tend to agree with you on some level, can we please make an effort in keeping the tone appropriate for a scientific community and phrase opinions for what they are, opinions, instead of making claims with absolute certainty that no un-clairvoyant being has any business making.


#25

My use case is to run a julia script and exit in under 2 seconds.
My experiments with a fairly simple script[1] is that it takes between 1.5 and 3 seconds.
Is there any way to use any pre-compilation to make this runtimes more consistent?

[1] It just reads a 19K JSON file and writes out a one line file.


Faster/consistent short lived script
#26

That might be related to the slow startup time of Julia compared to e.g. Python

time julia -e ""
real    0m0.323s
user    0m0.356s
sys     0m0.720s

 time python -c ""

real    0m0.018s
user    0m0.012s
sys     0m0.004s


#27

I don’t think static compilation will make startup time any faster.


#28

I just tried to compile the following program with BuildExecutable.jl and julia 0.5 (0.6 failed):

main() = begin end;
$ time ./test_exec/test_exec 

real	0m0.285s
user	0m0.212s
sys	0m0.096s

the same as:

$ time julia-0.5 -e "main()=begin end;main();"

real	0m0.268s
user	0m0.220s
sys	0m0.072s

both runs oscillate around 270ms
julia 0.6 is a little bit faster ~240ms

$ time julia-0.6 -e "main()=begin end;main();"

real	0m0.236s
user	0m0.180s
sys	0m0.072s

but doesn’t beat 0.4:

$ time julia-0.4 -e "main()=begin end;main();"

real	0m0.162s
user	0m0.116s
sys	0m0.064s

#29

What is the dominant cost of startup (assuming there is a single dominant cost)?


#30

Is there any update on this? I’m thinking about implementing some of my current project in Cython, but I would love it if I could use Julia instead. But I need to integrate whatever I do into Python seemlessly (from a user perspective, I’d like them to not know Julia is even there!)


#31

There have been some successful uses of https://github.com/JuliaComputing/static-julia


#32

6 posts were split to a new topic: Reluctance to switch to Julia; PyPy and Cython


#33

The current state of this work is at https://github.com/JuliaLang/PackageCompiler.jl


#34

One of the arguments for static compilation seems to be the commercial code and obfuscation argument.

I throw it open for discussion - when commercial Julia codes are being sold, will it be important to have obfuscated code? I do not have the answer.
I am assuming here there are no commercial Julia codes being sold at the moment. There may well be!


#35

An important question, but please consider opening a new topic.


#36

New topic Commercial codes using Julia - code obfuscation?


#37

Having the ability to create C Compatible Dynamic / Static Library from Julai Function would be amazing!

Making all the development in Julia, including the Unit Tests and then producing Dynamic / Static Library (With corresponding h File on all OS’s) would be a killer feature.

Many companies I know use MATLAB to do just that.
The Signal Processing Algorithm team does all the development on MATLAB then create a generated Code (Or Library) which is compiled with the whole project (Developed by the software team).
If Julia can generate much more efficient Compiled Library which has superior performance it will make a big step forward for those teams.

I understand it will come later on (Which is logical) yet I hope not too far in the future.
Is it realistic to have such feature within 2019?


#38

It would be nice to get grant from governements because more code could consume less energy and it could help prevent climate change! :wink: