"Store" the compiled version of algorithms


#1

Hi guys!

I have seen that, every time I restarted Julia, the first execution of a function in a package is somewhat slow, and the others are pretty fast. I understand that this is Julia compiling the code.

I do not understand those things about compilers and JITs and etc., but I am wondering: if the package did not change since the last execution, why this “compiled” version cannot be stored so that we do not have the overhead in the first call? I though that the __precompile__() directive was doing this.


#2

Do all the packages you are loading at startup have the __precompile__() directive?
Precompiling will become the default I believe, in v1.0.


#3

Yes, they have!


#4

For now, “precompiled” packages are not stored as machine code and so still suffer from some compilation overhead when you actually execute a function. The plan is to move closer to native code (what I think you are suggesting) to avoid this in the future: see issue 27362.


#5

Actually I was just trying to understand what is under the hood. You explained to me, now I get what the __precompile__ directive does :slight_smile:

Do you know if there is a milestone (1.0, 1.1 ?) in which this new compilation behavior will be implemented?


#6

If you want all the gory details, I’d recommend watching https://m.youtube.com/watch?v=7KGZ_9D_DbI#


#7

I watched… unfortunately I do not have …err how can I say… the right expertise to understand :smiley: