Skip to content

website: parse playground snippets once per run - #402

Merged
davydog187 merged 1 commit into
mainfrom
perf/playground-single-parse
Jul 27, 2026
Merged

website: parse playground snippets once per run#402
davydog187 merged 1 commit into
mainfrom
perf/playground-single-parse

Conversation

@davydog187

Copy link
Copy Markdown
Contributor

What

LuaSandbox.eval/3 parsed every playground snippet twice: once via Lua.parse_chunk/1 to build the bytecode pane, and again inside Lua.eval!/2. This reuses the compiled chunk for evaluation.

Why

Saves a full parse+compile per playground run — up to ~83µs on the metatables example snippet at current parse costs (and still the entire front-end cost once the lexer/compiler perf PRs land). Part of the sub-millisecond playground effort alongside #398#401.

Behavior

Unchanged. A parse failure falls through to Lua.eval!/2 on the raw source, so the CompilerException error path (and its formatted messages) is exactly as before. All 52 website tests pass.

LuaSandbox.eval/3 parsed every snippet twice: once via Lua.parse_chunk/1
for the bytecode pane and again inside Lua.eval!/2. Reuse the compiled
chunk for evaluation; a parse failure still falls through to eval!/2 on
the source so the CompilerException error path is unchanged.
@davydog187
davydog187 merged commit d0cf58f into main Jul 27, 2026
5 checks passed
@davydog187
davydog187 deleted the perf/playground-single-parse branch July 27, 2026 16:30
@davydog187 davydog187 mentioned this pull request Jul 28, 2026
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.

1 participant