Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#46190 new enhancement

Firefox Emoji Detection Slow

Reported by: superpoincare Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.0.3
Component: Emoji Keywords:
Focuses: Cc:


The emoji detection script loaded by default on WordPress is parser blocking but it still progressive enhancement as it

a) it runs fast,
b) finishes before the style requests are being downloaded.

However Firefox seems to have an issue in recent versions.

I tested the times it takes on Browserstack and sometimes it goes as high as more than 1s on both Windows and Mac.

The way I tested is by adding this code to functions.php

add_action( 'wp_head', function() {
<script>var e=new Date()</script>
}, 6 );

add_action( 'wp_head', function() {
<script>var n=new Date()-e;console.log(n)</script>
}, 7 );

so the the wp-emoji-loader.min.js inlined in the html head is sandwiched between getting the timestamps.

On other browsers it is like 8ms, 20ms but Firefox is really slow.

Likely a Firefox bug, but should be a workaround for it in WP.

Change History (1)

#1 @pento
3 years ago

This is kind of weird. I can reproduce some slowdown (~100ms in my tests) in Firefox on Windows when I first load the site in a new tab, but it's fast after that.

Unfortunately, the Firefox performance measurement tools aren't so good for drilling down into what's going on, so I kind of have to guess based on logging lots of timing statements.

The best guess I have is that toDataURL() seems to block on network issues: I'm able to make it more extreme by throttling the network connection. This isn't particularly reliable, though.

It's also worth noting that this method of timing has its own issues: adding a time check before window._wpemojiSettings is printed will often show a 70ms+ delay for no apparent reason.

Note: See TracTickets for help on using tickets.