joypixels / emoji-toolkit

The world's largest independent emoji font.
https://www.joypixels.com
Other
434 stars 47 forks source link

Poor performance on Android #50

Open stevebrowndotco opened 2 years ago

stevebrowndotco commented 2 years ago

Hello,I have a hybrid app built in Ionic. I noticed that when parsing emojis, the performance locks up the device, rendering it unusable for a period of 3 - 4 seconds. I am using in conjunction with ngx-markdown but I isolated the issue to this library.

Thank you!

zarko-tg commented 2 years ago

It's most likely this issue, still unresolved https://github.com/joypixels/emoji-toolkit/issues/1#issuecomment-819792200

netzzeit commented 1 year ago

Hey,

I'm facing the same issue in my capacitor project. It's working like a charm on iOS, but blocks the UI for a couple of seconds on Android (v11, v12, v13). I tried to put the first call into a setTimeout to handle the process asynchronously, but the blocking persists anyway.

Since there is no solution at the moment - did anyone find an alternative library to achieve the emoji-shortcode replacement? I'm using the shortcodeToUnicode function only.

Thanks a lot!

brenc commented 6 months ago

This has been happening for us for a while on desktop browsers (probably mobile too but most people use the built-in picker there). The first call to toImage takes several seconds to run but subsequent calls are fast.

brenc commented 6 months ago

This seems to be most pronounced with Chromium based browsers. Tested on Mac and Windows 11. Chrome, Arc, Brave, and Edge all take 3-4s on the initial call to toImage or shortnameToImage (anything that calls the line below). This might be why it's so pronounced on Android.

FF and Safari lag as well but it's < 1s. I've narrowed it down to this line in lib/js/joypixels.js (I'd link to the exact line but it crashes my browser):

str = str.replace(ns.regShortNames, function(shortname) {

I think something changed in Chromium in the past year or so as I have never had a problem before then. Still looking for a workaround for this.