Skip to content

Reduce component rendering and eager-loading overhead - #2760

Merged
joelhawksley merged 1 commit into
mainfrom
joelhawksley-benchmark-optimization-0c4
Oct 29, 2026
Merged

joelhawksley merged 1 commit into
mainfrom
joelhawksley-benchmark-optimization-0c4

Conversation

@joelhawksley

Copy link
Copy Markdown
Member

Reduce rendering and eager-loading overhead based on Vernier profiles, without changing benchmark workloads. Simplify compiled-cache and HTML-safety checks, reuse empty output and boot-time path parsing, and avoid unnecessary collection iterators and template/ancestor checks.

Measured with performance/measure.rb and performance/compare.rb, pooling three runs of 15 passes per version on Ruby 4.1-dev / Rails 8.1.4. Lower ratios are better: render time relative to partials, and ViewComponent boot time relative to the rest of boot.

Scenario main This branch Change
Component 0.196 0.189 -3.6%
Inline call 0.193 0.164 -14.9%
Inline ERB 0.178 0.167 -5.9%
Slots 0.022 0.021 -4.5%
Collection 0.166 0.154 -7.0%
Boot 1.110 1.017 -8.4%

Boot allocations decrease from 1,441,538 to 1,381,521. Includes regression coverage and a changelog entry.

@joelhawksley
joelhawksley merged commit 67b536f into main Oct 29, 2026
30 checks passed
@joelhawksley
joelhawksley deleted the joelhawksley-benchmark-optimization-0c4 branch October 29, 2026 21:00
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