JuliaLang/julia

Precompiling modules outside of packages

Open

#32 926 ouverte le 16 août 2019

Voir sur GitHub
 (7 commentaires) (8 réactions) (0 assignés)Julia (5 773 forks)batch import
docshelp wanted

Métriques du dépôt

Stars
 (48 709 stars)
Métriques de merge PR
 (Merge moyen 23j 11h) (145 PRs mergées en 30 j)

Description

As far as I can tell, there's currently no built-in way to cache a precompiled module if it's not part of a package. There's two problems here:

  1. This isn't made sufficiently clear by the documentation on module precompilation. In fact, that section of the docs says you can cache arbitrary precompiled modules by simply calling Base.compilecache. This is clearly not the case since Base.compilecache takes a PkgId as its argument.
  2. For use-cases involving distributing a single script with relatively long compilation-time and short run-time, this leaves a lot of performance on the table. For me a couple times its made the difference between whether or not Julia was a viable language for the problem.

So is there any way to either:

  1. Cache precompiled arbitrary modules using the current infrastructure in ~/.julia/compiled or
  2. Automatically cache modules not part of packages in the same directory as the file(s) with the module or
  3. Provide a documented way of creating .ji files programmatically for a given module from within julia code and also loading said .ji files if they already exist.

The documentation on module precompilation should also be fixed, but I'm not confident enough in my understanding of the relation between Base and Pkg to do so myself.

Guide contributeur