[wp-trac] [WordPress Trac] #60698: Token Map: Introduce an efficient lookup and translation class for string mappings.
WordPress Trac
noreply at wordpress.org
Mon May 13 20:37:33 UTC 2024
#60698: Token Map: Introduce an efficient lookup and translation class for string
mappings.
----------------------------------------------------+---------------------
Reporter: dmsnell | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: 6.6
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests 2nd-opinion | Focuses:
----------------------------------------------------+---------------------
Comment (by dmsnell):
Thanks @jorbin - I tried to do that but apparently failed to communicate
it well; sorry.
This was motivated by the needs of the HTML API for properly decoding HTML
named character references, and the [https://github.com/WordPress
/wordpress-develop/pull/6387 linked PR] demonstrates using this class for
that purpose.
The best performance characteristics I could come up with using existing
mechanisms were over nine times slower than with this optimized lookup.
The decoder itself is required because PHP is unable to accurately decode
the HTML entities according to the specification, partly due to its legacy
of using an XML parser, but also partly due to its interface which doesn't
acknowledge the more complicated rules in the HTML spec.
The linked PR contains substantially more warrant for the decoder, as well
as benchmarks and performance notes comparing different considered
approaches.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/60698#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list