Skip to content

perf: drop the precompile workload and run the package interpreted - #314

Merged
MichaelHatherly merged 2 commits into
masterfrom
mh/trim-workload
Oct 21, 2026
Merged

MichaelHatherly merged 2 commits into
masterfrom
mh/trim-workload

Conversation

@MichaelHatherly

@MichaelHatherly MichaelHatherly commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Drop the #309 precompile workload, which slowed loading of every dependent package, and run the package interpreted from Julia 1.6. Closes #313.

  • No PrecompileTools dependency. DSE loads in 2–4 ms again, against 27–35 ms in 0.10.1
  • The first render of four docstrings takes about 0.15 s, against 1 s in 0.10.0 and 0.1 s in 0.10.1
  • The CImGui.jl docs build takes about 41 s, the same as 0.10.1, against 52 s in 0.10.0

The workload from #309 cached about 4,400 specializations, most of them
Base methods, and verifying their backedges made DocStringExtensions take
33 ms to load where 0.10.0 took 4 ms. PrecompileTools also pulled in
Preferences, TOML and Dates. Each dependent package paid that on every
load, while the gain went only to sessions that render a docstring.

Without the workload the first render took 1 s. From Julia 1.6 the module
now sets `compile=min optimize=0`, keeping inference on so the type
stability checks still hold. Interpreted code costs nothing to compile,
but a closure passed to a Base function such as `map`, `filter`, `sort!`
or a comprehension compiles a new specialization of that function. So
the render path uses loops, and `methodgroups` groups by hand and sorts
with `insertion_sort!`, replacing `groupby` and two `sort!` calls. The
first render now takes about 0.19 s and loading about 4 ms.

Closes #313
…sures

`optimize=0` changed neither load time, first render nor the CImGui.jl
docs build, so the module sets `compile=min` alone.

A trace of the first render across every abbreviation still showed Base
compiling for DSE:

- `ComposedFunction` calls in `INSTANCES` and `SUBTYPES`
- closures on the signature and name-list paths, such as
  `collapse_defaults` and `print_name_list`
- `format(::ModuleImports)` itself, which Julia compiles because it holds
  a `ccall`

Those are loops now, and each `ccall` sits in a function of its own. The
first render of every abbreviation drops from 309 ms to 170 ms on
nightly. `AGENTS.md` records the rule so new code keeps to it.
@MichaelHatherly MichaelHatherly changed the title mh/trim workload perf: drop the precompile workload and run the package interpreted Oct 21, 2026
@MichaelHatherly
MichaelHatherly marked this pull request as ready for review October 21, 2026 11:19
@MichaelHatherly
MichaelHatherly merged commit 74505f8 into master Oct 21, 2026
13 of 15 checks passed
@MichaelHatherly
MichaelHatherly deleted the mh/trim-workload branch October 21, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Precompile workload slows loading of every dependent package

1 participant