[wp-trac] [WordPress Trac] #45930: Improve the performance of emoji iteration in `wp_encode_emoji()` and `wp_staticize_emoji()`

WordPress Trac noreply at wordpress.org
Thu Jan 10 22:49:25 UTC 2019


#45930: Improve the performance of emoji iteration in `wp_encode_emoji()` and
`wp_staticize_emoji()`
-------------------------+-----------------------------
 Reporter:  johnbillion  |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Emoji        |    Version:  4.9
 Severity:  normal       |   Keywords:
  Focuses:  performance  |
-------------------------+-----------------------------
 The `wp_encode_emoji()` and `wp_staticize_emoji()` functions perform a
 version comparison against the PHP version for every emoji that they
 iterate over - currently either 1,250 or 2,839 depending on whether the
 partial or full list of emoji are being iterated.

 This behaviour was introduced in [41702].

 By moving the PHP version comparison out of the loop, those thousands of
 comparisons are avoided and the processing time of both functions are
 reduced by approximately 50%.

 1,000 iterations of `wp_encode_emoji()` before the proposed change: 4.0
 seconds.\\
 1,000 iterations of `wp_encode_emoji()` after the proposed change: 1.9
 seconds.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45930>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list