Make WordPress Core

Opened 5 years ago

Last modified 23 months ago

#46190 new enhancement

Firefox Emoji Detection Slow

Reported by: superpoincare's profile superpoincare Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.0.3
Component: Emoji Keywords: needs-testing
Focuses: Cc:

Description

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

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

add_action( 'wp_head', function() {
        ?>
<script>var n=new Date()-e;console.log(n)</script>
        <?php
}, 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 (2)

#1 @pento
5 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.

#2 @JeffPaul
23 months ago

  • Keywords needs-testing added

After 3 years and updates to the versions of Firefox that core supports, I wonder if this is still even an issue so tagging this for needs-testing in hopes folks over in #core-test might grab this at some point and help validate whether the issue still exists or not.

Note: See TracTickets for help on using tickets.