[wp-trac] [WordPress Trac] #35293: Emoji Regex in wp_encode_emoji() is wildly inaccurate

WordPress Trac noreply at wordpress.org
Thu Aug 3 01:41:46 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 6.1

 After Test 6, try replacing the `str_replace()` with a simple
 `preg_replace()`. PHP's string functions are relatively slow for UTF-8,
 PCRE may be able to do things faster.

 '''Data''': https://travis-ci.org/pento/test-41501/builds/260434164

 '''Analysis''':
 - Moderate to significant performance improvements across the board.
 - New is now close or better than Old for the primary uses cases: between
 10ms slower and 20ms faster for 0% emoji, Short to Long posts, all
 languages, all PHP versions.
 - For secondary use cases (Short - Medium posts, all languages, 1% emoji),
 New is still slower, but not unworkably so. Old is usually 0.5-2ms, New is
 between 1-20ms, depending on PHP version.
 - For the edge cases that were causing severe performance issues on WP.com
 (super long posts, 0% emoji), New is now significantly faster than Old
 across all languages for PHP 5.4-5.6, and en_US on PHP 7.0+. It's still
 slower for non-en_US PHP 7.0+, but not server-crashingly slow.

 '''Conclusion''': Test 6.1 fixes up a lot of the performance penalties
 from Test 6, particularly the ones that cause WP.com issues.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/35293#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list