perf(Button): render LinkBase directly for plain buttons#6738
Draft
benjamincanac wants to merge 1 commit into
Draft
perf(Button): render LinkBase directly for plain buttons#6738benjamincanac wants to merge 1 commit into
benjamincanac wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Relates to #4154, #6293
❓ Type of change
📚 Description
Every
UButtonrenders aULink, even when it isn't a link. In that caseULinkresolves nothing: it computes slot props and wraps the content in a rekaSlot, adding two component instances per button whose only job is prop plumbing. Layer profiling (#6736) showed that per-instance overhead (Vue prop diffing and reactivity bookkeeping) is where most of a plain button's render cost lives.This renders
ULinkBasedirectly when no link-shaping prop is set (to,href,target,rel,noRel,external, all read through the props proxy so theme defaults still apply). Link buttons take the exact same path as before, andULink/ULinkBaseremain untouched, so patterns likeNavigationMenu'scustomslot keep working as is.Measured with the #6736 benches on this branch: plain Button re-render goes from 4,103 to 6,100 ops/s (+49%) and mount from 80 to 129 ops/s for a 25-button toolbar (+53%). In a playground reproduction with a 1,000-button grid the gain is visible in interaction timings. Output is byte-identical: full suite passes with zero snapshot changes, including attribute order.
Two things worth focused review:
inheritAttrs: falseand forwards$attrsexplicitly in both branches, positioned to preserve the exact DOM attribute order fallthrough attrs had when they traveled throughULink's slot props (a first version reorderedaria-labelvsclassand failed 703 snapshots, which would also have broken downstream users' snapshot tests).Stacked on #6736.
📝 Checklist