HTML API: Replace associative array for tracking parsed attributes. #5774
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.
Trac Ticket: Core-61545
Experimenting to determine if we have any measurable performance overhead in the associate array that previously stored parsed attribute tokens.
From:
To:
Previously we also tracked duplicate attributes so that we could remove them on
remove_attribute()
but in this case, we don't perform any determination for duplicate attributes until removing an attribute. This is because the first attribute (the one with the value) will appear first in the list of parsed attributes, and we can ignore the rest.Performance testing
In every case this has been improving the speed of the Tag Processor
by between 3% and 5%. Unfortunately I'm unable to upload images right now due to my internet connection, but I've tried with the
single-page.html
document that is the 12 MB spec document and thedemo-post.html
from Gutenberg and the results are consistent.All tests use marginally less memory as well, but the total memory usage is less than 2 KB so it's hardly a gain 🙃