Skip to content

ast: build the lowering context on first use - #63067

Open
levy wants to merge 1 commit into
JuliaLang:masterfrom
levy:pr-ast-lazy-lowering-context
Open

ast: build the lowering context on first use#63067
levy wants to merge 1 commit into
JuliaLang:masterfrom
levy:pr-ast-lazy-lowering-context

Conversation

@levy

@levy levy commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

jl_init_flisp loads the flisp system image at every start. A program that never lowers an expression never needs it, and jl_ast_ctx_enter already builds a context when its free list is empty. The eager build becomes the mutex initialization alone, and the static context goes away.

julia --startup-file=no -e '': 76.4 → 66.2 ms, minimum of 15 pinned runs (median 77.2 → 66.9). A script or a REPL lowers immediately and gains nothing; a compiled program gains the same 7 ms.

The context is built inside JL_SIGATOMIC_BEGIN, as the free-list path already did. syntax, meta and core pass.

Fixes #63066. Part of #63065.

Disclosure: developed with Claude Code (Opus 5) under my direction. It wrote the code and this text; the measurements were run on my machine. I reviewed the changes. The commits carry an Assisted-by trailer.

@levy
levy force-pushed the pr-ast-lazy-lowering-context branch from fd96568 to ce18535 Compare September 8, 2026 08:48
`jl_init_flisp` loaded the flisp system image at every start. A program that
never lowers an expression never needs it, and `jl_ast_ctx_enter` already
builds a context when its free list is empty, so the eager call becomes the
mutex initialization alone.

`julia --startup-file=no -e ''`: 76.4 → 66.2 ms, minimum of 15 pinned runs.
A REPL or a script lowers immediately and is unaffected; a compiled program
gains the same 7 ms.

Assisted-by: Claude Code (Opus 5)
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.

jl_init_flisp builds the lowering context at every start, and a compiled program never lowers

1 participant