joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 536 forks source link

Horrible performance after upgrade to 4.0.0 #639

Closed padinko closed 5 years ago

padinko commented 5 years ago

We have page with many user inputs We only want to transform unicode characters. no shortcodes

With 544 inputs and use unicodeToImage in 3.1.7, it takes ~1.47s With 544 inputs and use toImage in 3.1.7, it takes ~1.55s

After we upgrade to 4.0.0.. times are not usable With 544 inputs: method unicodeToImage do nothing.. Why you remove this? We only want transform this With 544 input and use toImage in 4.0.0, it takes ~20.8s

I need to stay on 3 because of performance and unicodeToImage

caseyahenson commented 5 years ago

@padinko sorry to hear that you're experiencing such a long processing time. Can you provide a few details about your integration so that we can attempt to recreate and resolve this?

As for unicodeToImage, the idea was to unify the replacement by mapping everything through toImage, thereby converting replacements to shortname, then to image. This was causing minimal additional processing time in testing.

Do you have a situation where you wish to replace unicode characters but not shortnames within the same string?

padinko commented 5 years ago

I did some demos (check console for times): v3.1.7 - https://jsfiddle.net/76qcth83/ ~0.07s v4.0.0 - https://jsfiddle.net/mzhqyagv/ ~9s v4.5.0 - https://jsfiddle.net/6dba573x/ ~9s

Our project needs only emojis from emoji keyboard are shown as emojione. So when someone input :smiley: it will not be replaced (I know it's very unlikely, but emojione 3 have this feature)

caseyahenson commented 5 years ago

@padinko thanks for creating these examples. We'll make sure to optimize these for the next release.

caseyahenson commented 5 years ago

This is improved upon in the 5.0 release https://github.com/joypixels/emoji-toolkit/releases/tag/5.0.0.