Skip to content

Commit af85852

Browse files
authored
The great renaming (#5)
1 parent 7b80794 commit af85852

22 files changed

+119
-118
lines changed

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ jobs:
5757
- run: |
5858
julia --project=docs -e '
5959
using Documenter: DocMeta, doctest
60-
using Precompiler
61-
DocMeta.setdocmeta!(Precompiler, :DocTestSetup, :(using Precompiler); recursive=true)
62-
doctest(Precompiler)'
60+
using PrecompileTools
61+
DocMeta.setdocmeta!(PrecompileTools, :DocTestSetup, :(using PrecompileTools); recursive=true)
62+
doctest(PrecompileTools)'

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name = "Precompiler"
1+
name = "PrecompileTools"
22
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
33
authors = ["Tim Holy <[email protected]>", "t-bltg <[email protected]>", "and contributors"]
44
version = "1.0.0"

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# Precompiler
1+
# PrecompileTools
22

3-
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaLang.github.io/Precompiler.jl/stable/)
4-
[![Build Status](https://github.com/JuliaLang/Precompiler.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaLang/Precompiler.jl/actions/workflows/CI.yml?query=branch%3Amain)
5-
[![Coverage](https://codecov.io/gh/JuliaLang/Precompiler.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaLang/Precompiler.jl)
3+
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaLang.github.io/PrecompileTools.jl/stable/)
4+
[![Build Status](https://github.com/JuliaLang/PrecompileTools.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/JuliaLang/PrecompileTools.jl/actions/workflows/CI.yml?query=branch%3Amain)
5+
[![Coverage](https://codecov.io/gh/JuliaLang/PrecompileTools.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaLang/PrecompileTools.jl)
66

7-
Precompiler allows you to reduce the latency of the first execution of Julia code.
7+
PrecompileTools allows you to reduce the latency of the first execution of Julia code.
88
**It is applicable for package developers and for "ordinary users" in their personal workflows.**
99

10-
To learn how to use Precompiler, see the [documentation](https://JuliaLang.github.io/Precompiler.jl/stable/).
10+
To learn how to use PrecompileTools, see the [documentation](https://JuliaLang.github.io/PrecompileTools.jl/stable/).
1111

12-
## Precompiler and PackageCompiler
12+
## PrecompileTools and PackageCompiler
1313

14-
Particularly on Julia 1.9 and higher, Precompiler allows dramatic reduction in "time to first execution" (TTFX).
14+
Particularly on Julia 1.9 and higher, PrecompileTools allows dramatic reduction in "time to first execution" (TTFX).
1515
In this respect, it shares goals with (and performs similarly to) [PackageCompiler](https://github.com/JuliaLang/PackageCompiler.jl).
1616
Nevertheless, the two are not identical:
1717

18-
- only Precompiler can be used by *package developers* to ensure a better out-of-box experience for your users
19-
- only Precompiler allows you to update your packages without needing to rebuild Julia
18+
- only PrecompileTools can be used by *package developers* to ensure a better out-of-box experience for your users
19+
- only PrecompileTools allows you to update your packages without needing to rebuild Julia
2020
- only PackageCompiler dramatically speeds up loading time (i.e., `using ...`) for all the packages
2121

2222
## History (origins as SnoopPrecompile)
2323

24-
Precompiler is the successor to [SnoopPrecompile](https://github.com/timholy/SnoopCompile.jl/tree/master/SnoopPrecompile).
25-
Precompiler differs in naming and in how one disables precompilation, but is otherwise a drop-in replacement.
24+
PrecompileTools is the successor to [SnoopPrecompile](https://github.com/timholy/SnoopCompile.jl/tree/master/SnoopPrecompile).
25+
PrecompileTools differs in naming and in how one disables precompilation, but is otherwise a drop-in replacement.

docs/Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ git-tree-sha1 = "478ac6c952fddd4399e71d4779797c538d0ff2bf"
6868
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
6969
version = "2.5.8"
7070

71-
[[deps.Precompiler]]
71+
[[deps.PrecompileTools]]
7272
deps = ["Preferences"]
7373
path = ".."
7474
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"

docs/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3-
Precompiler = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
3+
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"

docs/make.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
using Precompiler
1+
using PrecompileTools
22
using Documenter
33

4-
DocMeta.setdocmeta!(Precompiler, :DocTestSetup, :(using Precompiler); recursive=true)
4+
DocMeta.setdocmeta!(PrecompileTools, :DocTestSetup, :(using PrecompileTools); recursive=true)
55

66
makedocs(;
7-
modules=[Precompiler],
7+
modules=[PrecompileTools],
88
authors="Tim Holy <[email protected]>, t-bltg <[email protected]>, and contributors",
9-
repo="https://github.com/JuliaLang/Precompiler.jl/blob/{commit}{path}#{line}",
10-
sitename="Precompiler.jl",
9+
repo="https://github.com/JuliaLang/PrecompileTools.jl/blob/{commit}{path}#{line}",
10+
sitename="PrecompileTools.jl",
1111
format=Documenter.HTML(;
1212
prettyurls=get(ENV, "CI", "false") == "true",
13-
canonical="https://JuliaLang.github.io/Precompiler.jl",
13+
canonical="https://JuliaLang.github.io/PrecompileTools.jl",
1414
edit_link="main",
1515
assets=String[],
1616
),
@@ -21,7 +21,7 @@ makedocs(;
2121
)
2222

2323
deploydocs(;
24-
repo="github.com/JuliaLang/Precompiler.jl",
24+
repo="github.com/JuliaLang/PrecompileTools.jl",
2525
push_preview=true,
2626
devbranch="main",
2727
)

docs/src/index.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
# Precompiler
1+
# PrecompileTools
22

33
## Overview
44

5-
`Precompiler` is designed to help reduce delay on first usage of Julia code.
5+
`PrecompileTools` is designed to help reduce delay on first usage of Julia code.
66
It can force *precompilation* of specific workloads; particularly with Julia 1.9 and higher,
77
the precompiled code can be saved to disk, so that it doesn't need to be compiled freshly in each Julia session.
8-
You can use `Precompiler` as a package developer, to reduce the latency experienced by users of your package for "typical" workloads;
9-
you can also use `Precompiler` as a user, creating custom "Startup" package(s) that precompile workloads important for your work.
8+
You can use `PrecompileTools` as a package developer, to reduce the latency experienced by users of your package for "typical" workloads;
9+
you can also use `PrecompileTools` as a user, creating custom "Startup" package(s) that precompile workloads important for your work.
1010

11-
The main tool in `Precompiler` is a macro, `Precompiler.@cache`, which precompiles every call on its first usage.
12-
It also includes a second macro, `Precompiler.@setup`, which can be used to "mark" a block of code as being relevant only
13-
for precompilation but which does not itself force compilation of setup code. (`@setup` is typically used to generate
11+
The main tool in `PrecompileTools` is a macro, `@compile_workload`, which precompiles all the code needed to execute the workload.
12+
It also includes a second macro, `@setup_workload`, which can be used to "mark" a block of code as being relevant only
13+
for precompilation but which does not itself force compilation of `@setup_workload` code. (`@setup_workload` is typically used to generate
1414
test data using functions that you don't need to precompile in your package.)
1515

1616
## Tutorial
1717

1818
No matter whether you're a package developer or a user looking to make your own workloads start faster,
19-
the basic workflow of `Precompiler` is the same.
20-
Here's an illustration of how you might use `Precompiler.@cache` and `Precompiler.@setup`:
19+
the basic workflow of `PrecompileTools` is the same.
20+
Here's an illustration of how you might use `@compile_workload` and `@setup_workload`:
2121

2222
```julia
2323
module MyPackage
2424

25-
using Precompiler # this is a small dependency
25+
using PrecompileTools # this is a small dependency
2626

2727
struct MyType
2828
x::Int
@@ -31,11 +31,11 @@ struct OtherType
3131
str::String
3232
end
3333

34-
Precompiler.@setup begin
35-
# Putting some things in `@setup` instead of `@cache` can reduce the size of the
34+
@setup_workload begin
35+
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
3636
# precompile file and potentially make loading faster.
3737
list = [OtherType("hello"), OtherType("world!")]
38-
Precompiler.@cache begin
38+
@compile_workload begin
3939
# all calls in this block will be precompiled, regardless of whether
4040
# they belong to your package or not (on Julia 1.8 and higher)
4141
d = Dict(MyType(1) => list)
@@ -58,26 +58,26 @@ When you build `MyPackage`, it will precompile the following, *including all the
5858
In this case, the "top level" calls were fully inferrable, so there are no entries on this list
5959
that were called by runtime dispatch. Thus, here you could have gotten the same result with manual
6060
`precompile` directives.
61-
The key advantage of `Precompiler.@cache` is that it works even if the functions you're calling
61+
The key advantage of `@compile_workload` is that it works even if the functions you're calling
6262
have runtime dispatch.
6363

64-
Once you set up a block using `Precompiler`, try your package and see if it reduces the time to first execution,
65-
using the same workload you put inside the `Precompiler.@cache` block.
64+
Once you set up a block using `PrecompileTools`, try your package and see if it reduces the time to first execution,
65+
using the same workload you put inside the `@compile_workload` block.
6666

6767
If you're happy with the results, you're done! If you want deeper verification of whether it worked as
6868
expected, or if you suspect problems, the [SnoopCompile package](https://github.com/timholy/SnoopCompile.jl) provides diagnostic tools.
6969
Potential sources of trouble include invalidation (diagnosed with `SnoopCompileCore.@snoopr` and related tools)
70-
and omission of intended calls from inside the `Precompiler.@cache` block (diagnosed with `SnoopCompileCore.@snoopi_deep` and related tools).
70+
and omission of intended calls from inside the `@compile_workload` block (diagnosed with `SnoopCompileCore.@snoopi_deep` and related tools).
7171

7272
!!! note
73-
`Precompiler.@cache` works by monitoring type-inference. If the code was already inferred
74-
prior to `Precompiler.@cache` (e.g., from prior usage), you might omit any external
73+
`@compile_workload` works by monitoring type-inference. If the code was already inferred
74+
prior to `@compile_workload` (e.g., from prior usage), you might omit any external
7575
methods that were called via runtime dispatch.
7676

77-
You can use multiple `Precompiler.@cache` blocks if you need to interleave "setup" code with
77+
You can use multiple `@compile_workload` blocks if you need to interleave `@setup_workload` code with
7878
code that you want precompiled.
7979
You can use `@snoopi_deep` to check for any (re)inference when you use the code in your package.
80-
To fix any specific problems, you can combine `Precompiler.@cache` with manual `precompile` directives.
80+
To fix any specific problems, you can combine `@compile_workload` with manual `precompile` directives.
8181

8282
## Tutorial: local "Startup" packages
8383

@@ -113,20 +113,20 @@ From each one of those `Project` folders you could do the following:
113113
(Project1) pkg> activate Startup/
114114
Activating project at `/tmp/Project1/Startup`
115115
116-
(Startup) pkg> add Precompiler LotsOfPackages...
116+
(Startup) pkg> add PrecompileTools LotsOfPackages...
117117
```
118118

119-
In the last step, you add `Precompiler` and all the package you'll need for your work on `Project1`
119+
In the last step, you add `PrecompileTools` and all the package you'll need for your work on `Project1`
120120
as dependencies of `Startup`.
121121
Then edit the `Startup/src/Startup.jl` file to look similar to the tutorial previous section, e.g.,
122122

123123
```julia
124124
module Startup
125125

126126
using LotsOfPackages...
127-
using Precompiler
127+
using PrecompileTools
128128

129-
Precompiler.@cache begin
129+
@compile_workload begin
130130
# inside here, put a "toy example" of everything you want to be fast
131131
end
132132

@@ -143,59 +143,59 @@ All the packages will be loaded, together with their precompiled code.
143143

144144
There are cases where you might want to precompile code but cannot safely *execute* that code: for example, you may need to connect to a database, or perhaps this is a plotting package but you may be currently on a headless server lacking a display, etc.
145145
In that case, your best option is to fall back on Julia's own `precompile` function.
146-
However, as explained in [How Precompiler works](@ref), there are some differences between `precompile` and `Precompiler.@cache`;
146+
However, as explained in [How PrecompileTools works](@ref), there are some differences between `precompile` and `@compile_workload`;
147147
most likely, you may need multiple `precompile` directives.
148148
Analysis with [SnoopCompile](https://github.com/timholy/SnoopCompile.jl) may be required to obtain the results you want.
149149

150150
## Package developers: reducing the cost of precompilation during development
151151

152152
If you're frequently modifying one or more packages, you may not want to spend the extra time precompiling the full set of workloads that you've chosen to make fast for your "shipped" releases.
153-
One can *locally* reduce the cost of precompilation for selected packages using the `Preferences.jl`-based mechanism and the `skip_precompile` key: from within your development environment, use
153+
One can *locally* reduce the cost of precompilation for selected packages using the `Preferences.jl`-based mechanism and the `"precompile_workload"` key: from within your development environment, use
154154

155155
```julia
156156
using MyPackage, Preferences
157-
set_preferences!(MyPackage, "skip_precompile" => true; force=true)
157+
set_preferences!(MyPackage, "precompile_workload" => false; force=true)
158158
```
159159

160-
After restarting julia, the `Precompiler.@cache` and `Precompiler.@setup` workloads will be disabled (locally) for `MyPackage`.
160+
After restarting julia, the `@compile_workload` and `@setup_workload` workloads will be disabled (locally) for `MyPackage`.
161161
You can also specify additional packages (e.g., dependencies of `MyPackage`) if you're co-developing a suite of packages.
162162

163163
!!! note
164-
Changing `skip_precompile` will result in a one-time recompilation of all packages that use the package(s) from the current environment.
164+
Changing `precompile_workload` will result in a one-time recompilation of all packages that depend on the package(s) from the current environment.
165165
Package developers may wish to set this preference locally within the "main" package's environment;
166166
precompilation will be skipped while you're actively developing the project, but not if you use the package
167-
from an external environment. This will also keep the `skip_precompile` setting independent and avoid needless recompilation
167+
from an external environment. This will also keep the `precompile_workload` setting independent and avoid needless recompilation
168168
of large environments.
169169

170170
## Seeing what got precompiled
171171

172172
If you want to see the list of calls that will be precompiled, navigate to the `MyPackage` folder and use
173173

174174
```julia
175-
julia> using Precompiler
175+
julia> using PrecompileTools
176176

177-
julia> Precompiler.verbose[] = true # runs the block even if you're not precompiling, and print precompiled calls
177+
julia> PrecompileTools.verbose[] = true # runs the block even if you're not precompiling, and print precompiled calls
178178

179179
julia> include("src/MyPackage.jl");
180180
```
181181

182182
This will only show the direct- or runtime-dispatched method instances that got precompiled (omitting their inferrable callees).
183-
For a more comprehensive list of all items stored in the cache file, see
183+
For a more comprehensive list of all items stored in the compile_workload file, see
184184
[PkgCacheInspector](https://github.com/timholy/PkgCacheInspector.jl).
185185

186-
## How Precompiler works
186+
## How PrecompileTools works
187187

188188
Julia itself has a function `precompile`, to which you can pass specific signatures to force precompilation.
189189
For example, `precompile(foo, (ArgType1, ArgType2))` will precompile `foo(::ArgType1, ::ArgType2)` *and all of its inferrable callees*.
190190
Alternatively, you can just execute some code at "top level" within the module, and during precompilation any method or signature "owned" by your package will also be precompiled.
191191
Thus, base Julia itself has substantial facilities for precompiling code.
192192

193-
`Precompiler.@cache` adds one key feature: the *non-inferrable callees* (i.e., those called via runtime dispatch) that get
194-
made inside the `@cache` block will also be cached, *regardless of module ownership*. In essence, it's like you're adding
195-
an explicit `precompile(noninferrable_callee, (OtherArgType1, ...))` for every runtime-dispatched call made inside `Precompiler.@cache`.
193+
`@compile_workload` adds one key feature: the *non-inferrable callees* (i.e., those called via runtime dispatch) that get
194+
made inside the `@compile_workload` block will also be cached, *regardless of module ownership*. In essence, it's like you're adding
195+
an explicit `precompile(noninferrable_callee, (OtherArgType1, ...))` for every runtime-dispatched call made inside `@compile_workload`.
196196

197-
`Precompiler` adds other features as well:
197+
`PrecompileTools` adds other features as well:
198198

199-
- Statements that occur inside a `Precompiler.@cache` block are executed only if the package is being actively precompiled; it does not run when the package is loaded, nor if you're running Julia with `--compiled-modules=no`.
200-
- Compared to just running some workload at top-level, `Precompiler.@cache` ensures that your code will be compiled (it disables the interpreter inside the block)
201-
- Precompiler also defines `Precompiler.@setup`, which you can use to create data for use inside a `Precompiler.@cache` block. Like `Precompiler.@cache`, this code only runs when you are precompiling the package, but it does not necessarily result in the "setup" code being stored in the package precompile file.
199+
- Statements that occur inside a `@compile_workload` block are executed only if the package is being actively precompiled; it does not run when the package is loaded, nor if you're running Julia with `--compiled-modules=no`.
200+
- Compared to just running some workload at top-level, `@compile_workload` ensures that your code will be compiled (it disables the interpreter inside the block)
201+
- PrecompileTools also defines `@setup_workload`, which you can use to create data for use inside a `@compile_workload` block. Like `@compile_workload`, this code only runs when you are precompiling the package, but it does not necessarily result in the `@setup_workload` code being stored in the package precompile file.

docs/src/reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
```@meta
2-
CurrentModule = Precompiler
2+
CurrentModule = PrecompileTools
33
```
44

55
# Reference (API)
66

7-
API documentation for [Precompiler](https://github.com/JuliaLang/Precompiler.jl).
7+
API documentation for [PrecompileTools](https://github.com/JuliaLang/PrecompileTools.jl).
88

99
```@index
1010
```
1111

1212
```@autodocs
13-
Modules = [Precompiler]
13+
Modules = [PrecompileTools]
1414
```

0 commit comments

Comments
 (0)