Skip to content

Some micro-optimizations centered around tagName/nodeName - #3839

Merged
domenic merged 1 commit into
mainfrom
faster-string-ops
Mar 15, 2025
Merged

domenic merged 1 commit into
mainfrom
faster-string-ops

Conversation

@domenic

@domenic domenic commented Mar 15, 2025 •

Copy link
Copy Markdown
Member
  • Implement a faster version of toASCIIUppercase, which is used by tagName. (Also do the same for toASCIILowercase while we're there.)
  • Access _namespaceURI directly, since the getter showed up as 0.2% of the profile, and although I'm skeptical of that being real, it doesn't hurt.
  • Most importantly, stop accessing nodeName when possible:
    • In the non-error cases of _preInsertValidity(), we can just avoid it. This shows up for all appends.
    • In the isNamedPropertyElement() check, we can just use _localName. This also shows up for all appends.
    • In other cases scattered throughout the codebase we can use _localName. These were just fixed while we're in the area.

Part of #3154.

@domenic
domenic force-pushed the faster-string-ops branch from 93bc80e to c968af5 Compare March 15, 2025 10:44
@domenic domenic changed the title Some micro-optimizations centered around tagName Some micro-optimizations centered around tagName/nodeName Mar 15, 2025
@domenic
domenic changed the base branch from reflecturl-cache to main March 15, 2025 10:44
* Implement a faster version of toASCIIUppercase, which is used by tagName. (Also do the same for toASCIILowercase while we're there.)
* Access _namespaceURI directly, since the getter showed up as 0.2% of the profile, and although I'm skeptical of that being real, it doesn't hurt.
* Most importantly, stop accessing nodeName when possible:
    * In the non-error cases of _preInsertValidity(), we can just avoid it. This shows up for all appends.
    * In the isNamedPropertyElement() check, we can just use localName. This also shows up for all appends.
    * In other cases scattered throughout the codebase we can use localName. This were just fixed while we're in the area.

Part of #3154.
@domenic
domenic force-pushed the faster-string-ops branch from c968af5 to bb741a5 Compare March 15, 2025 11:09
@domenic
domenic merged commit ce77956 into main Mar 15, 2025
@domenic
domenic deleted the faster-string-ops branch March 15, 2025 13:07
@domenic domenic added the metr uplift A candidate for the METR Uplift experiment label Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

metr uplift A candidate for the METR Uplift experiment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant