[wp-trac] [WordPress Trac] #35293: Emoji Regex in wp_encode_emoji() is wildly inaccurate
WordPress Trac
noreply at wordpress.org
Wed Aug 2 11:39:53 UTC 2017
#35293: Emoji Regex in wp_encode_emoji() is wildly inaccurate
--------------------------+-----------------------
Reporter: pento | Owner: pento
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 4.9
Component: Emoji | Version: 4.2
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+-----------------------
Comment (by pento):
== TEST 4
Regexen are clearly slow, and there are 2661 emoji in the Twemoji library.
Let's try putting it in an array, and `str_replace()` with each element in
said array.
'''Data''': https://travis-ci.org/pento/test-41501/jobs/260153544
Analysis:
- For PHP 5.4-5.6, this faster than the baseline for every test except
short posts, where time is up from <10ms, to ~30ms.
- For Long and Super Long posts, the difference is dramatic - down from
500ms to 40ms, and 4600ms to 100ms, respectively.
- For PHP 7.0+, the difference is similar, but less dramatic - the
baseline was already usably fast.
- Compared to Old, there's still some work to do - there are several cases
where Old processes in <5 ms, where New takes 30+ms. For longer posts,
however, New is faster.
Conclusion: Test 4 is worth attempting to optimise further.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35293#comment:30>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list