Skip to content

Reduce cache digest reads and allocations - #2772

Merged
joelhawksley merged 1 commit into
mainfrom
joelhawksley-benchmark-performance
Nov 3, 2026
Merged

joelhawksley merged 1 commit into
mainfrom
joelhawksley-benchmark-performance

Conversation

@joelhawksley

Copy link
Copy Markdown
Member

Reuse source-file reads during digest hashing and avoid per-node AST allocations.

Benchmark Time ratio change Allocations (base → head)
Cold digest -5.7% 76,627 → 73,755 (-3.7%)
Boot -1.9% 1,374,557 → 1,333,315 (-3.0%)

Three paired 15-pass runs on Ruby 4.1-dev / Rails 8.1.4, with unchanged workloads. Rendering scenarios measured 0.5–1.6% slower, with unchanged allocations.

Benchmark commands

Compare against 5e1e82a2. Repeat the measurement pair three times, using separate output files and reversing the order in the second round.

git worktree add tmp/base 5e1e82a2
PASSES=15 VIEW_COMPONENT_LIB=tmp/base/lib bundle exec ruby performance/measure.rb tmp/performance/base/1.json
PASSES=15 bundle exec ruby performance/measure.rb tmp/performance/head/1.json
bundle exec ruby performance/compare.rb tmp/performance/base tmp/performance/head

Time ratios compare component digests against partial digests, and ViewComponent boot time against the rest of boot. Lower is better.

@joelhawksley
joelhawksley merged commit 88eacfe into main Nov 3, 2026
30 checks passed
@joelhawksley
joelhawksley deleted the joelhawksley-benchmark-performance branch November 3, 2026 19:38
@joelhawksley
joelhawksley restored the joelhawksley-benchmark-performance branch November 3, 2026 19:38
@joelhawksley
joelhawksley deleted the joelhawksley-benchmark-performance branch November 3, 2026 19:38
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