Performance - class style fast path#157
Closed
SanderMuller wants to merge 2 commits intolivewire:mainfrom
Closed
Conversation
When called with a plain string (the common case), bypass the full merge() cycle entirely — directly append the class value to the existing attributes array. This avoids the escape loop, partitioning, and array_merge overhead. Benchmarks show -66% improvement on the class benchmark (blaze/blade ratio).
Symmetric optimization to the class() fast path — directly append style values when given a plain string, bypassing the full merge() cycle.
Contributor
Author
|
/benchmark class |
Contributor
Benchmark Result: Default
Median of 10 attempts (* = outlier, excluded from result), 5000 iterations x 10 rounds, 45.55s total To run a specific benchmark, comment |
Contributor
Benchmark Result: Class
Median of 10 attempts (* = outlier, excluded from result), 5000 iterations x 10 rounds, 32.16s total To run a specific benchmark, comment |
Collaborator
|
I like this but feels like we're duplicating a lot of code also in #161. Would you be able to merge these together into one PR and see if we can extract some of the logic into separate methods please? |
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.
When
class()orstyle()is called with a plain string (the common case), bypass the fullmerge()cycle and directly append the value to the attributes array. Avoids the escape loop, attribute partitioning, andarray_mergeoverhead.Biggest single win: -66% on the class benchmark (blaze/blade ratio).