Skip to content

Precompiling modules outside of packages #32926

@non-Jedi

Description

@non-Jedi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis change adds or pertains to documentationhelp wantedIndicates that a maintainer wants help on an issue or pull request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions