Make WordPress Core

Changes between Initial Version and Version 3 of Ticket #61545


Ignore:
Timestamp:
07/01/2024 09:41:33 PM (2 years ago)
Author:
dmsnell
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #61545

    • Property Keywords has-patch has-unit-tests added
  • Ticket #61545 – Description

    initial v3  
    11The HTML API is already efficient, but it can (possibly) be better.
    22
    3 There are multiple ways to potentially improve the performance of the Tag Processor, HTML Processor, and HTML Decoder. This ticket is a tracking ticket for those experiments and changes.
     3There are multiple ways to potentially improve the performance of the Tag Processor, HTML Processor, and HTML Decoder. This ticket is a tracking ticket for those experiments and changes
     4
     5== Experiments
     6
     7=== Optimize low-level details: [https://github.com/WordPress/wordpress-develop/pull/6890 #6890]
     8
     9**Hypothesis**: by auditing various low-level functions and adding a few micro-optimizations, the HTML Tag Processor will scan faster.
     10
     11**Testing results**: This change seems to have a marked improvement in scanning times, but since there are several changes incorporated into the patch it's unclear if any specific change was dominant. Of interest are a few places in the hot patch where a branch was removed.
     12
     13Improvement in the token-scanning measures between 3.5% and 7.5% on average, a small tail of documents are slower, and a long tail are much faster, even above 15% faster. It's unclear what exactly directs the performance behaviors, but it's complicated and document-dependent.
     14
     15**Conclusion**:
     16
     17        - Merge this patch.
     18        - Continue trying to build a model for what directs the performance behaviors.
     19
     20=== Replace the attribute associative array with a simple list. [https://github.com/WordPress/wordpress-develop/pull/5774 #5774]
     21
     22**Hypothesis**: by replacing the associative array and hash lookup of parsed attributes with a numeric array the Tag Processor will perform less work and go faster. This should be accomplished by skipping that hash lookup for the associative array of known attributes and by skipping the comparable lookup for detecting duplicates. In HTML, the first attribute is the real one, so it's okay to track a location for every duplicate attribute and simply find the //first// parsed one as the real attribute.
     23
     24**Testing results**: TBD.
     25
     26**Conclusion**:
     27
     28        - Need to update the PR to rebase against the current `trunk`.
     29        - Need to run benchmarks against one of the large datasets, like the `top100` list.