Skip to content

perf(forge): avoid compiling for doc generation#15702

Merged
grandizzy merged 2 commits into
masterfrom
fig/doc-solar-direct
Jul 13, 2026
Merged

perf(forge): avoid compiling for doc generation#15702
grandizzy merged 2 commits into
masterfrom
fig/doc-solar-direct

Conversation

@figtracer

@figtracer figtracer commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Configure the bundled, in-process Solar parser directly for forge doc, avoiding the ABI-only compiler process when every Solidity source is Solar-compatible.
  • Preserve existing behavior for pre-0.8, mixed-version, and Solidity-free projects through the compiler-backed fallback, and honor configured skip filters on the fast path.
  • Add regression coverage proving the fast path neither invokes solc nor documents skipped sources, while empty and mixed-version projects retain their fallback behavior.

Benchmarks

Benchmarked release builds on Solady with 277 Solidity files. Each sample removed out, cache, and both generated doc directories:

hyperfine --warmup 1 --runs 10 \
  --prepare 'rm -rf out cache /tmp/solady-doc-before /tmp/solady-doc-after' \
  'forge-before doc --out /tmp/solady-doc-before --quiet' \
  'forge-after doc --out /tmp/solady-doc-after --quiet'
Before: 1.412 s ± 0.032 s
After:  135.8 ms ± 8.9 ms
Speedup: 10.40x

The generated documentation is identical according to diff -qr.

@figtracer figtracer marked this pull request as ready for review July 13, 2026 08:22

@mattsse mattsse left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mablr mablr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, big gain on big projects like aave-v4.

@grandizzy grandizzy merged commit cffef5d into master Jul 13, 2026
19 of 20 checks passed
@grandizzy grandizzy deleted the fig/doc-solar-direct branch July 13, 2026 08:36
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants