Skip to content

Speed up component rendering and eager loading - #2759

Merged
joelhawksley merged 2 commits into
mainfrom
joelhawksley-benchmark-optimization-528
Oct 29, 2026
Merged

joelhawksley merged 2 commits into
mainfrom
joelhawksley-benchmark-optimization-528

Conversation

@joelhawksley

Copy link
Copy Markdown
Member

What are you trying to accomplish?

Make rendering and boot faster using the existing benchmarks and Vernier.

What approach did you choose and why?

Share source-file reads during eager loading, avoid repeated virtual-path lookups, and reduce nested-render and default-slot lookup overhead. File reads remain uncached outside eager loading.

Anything you want to highlight for special attention from reviewers?

Three paired runs, 45 samples per scenario, Ruby 4.1-dev / Rails 8.1.4. Ratios normalize rendering against an equivalent partial, and ViewComponent boot time against the rest of boot; lower is better.

Benchmark Main ratio Optimized ratio Reduction
Component 0.210 0.198 5.8%
Inline call 0.206 0.192 7.1%
Inline ERB 0.188 0.178 5.3%
Slots 0.022 0.022 1.8%
Collection 0.167 0.163 2.5%
Boot 1.192 1.092 8.4%

No scenario regressed. bundle exec rake all_tests and targeted StandardRB checks passed.

@joelhawksley
joelhawksley merged commit 5a10368 into main Oct 29, 2026
29 checks passed
@joelhawksley
joelhawksley deleted the joelhawksley-benchmark-optimization-528 branch October 29, 2026 20:07
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