Emoji picker search performance

(David Taylor) #1

When using the emoji picker on mobile devices, it can be quite sluggish when typing into the search box. Waiting a bit of time for results isn’t a problem, but something seems to be impacting the performance of the <input> field itself.

The easiest way to repro is using the CPU slowdown options in the chrome dev tools. It seems to be worse when pressing the backspace key. Here’s a video - I pressed backspace 5 times in quick succession, and you can see that the text in the input field disappears sporadically. (6x CPU slowdown in chrome dev tools, to exaggerate the problem)

It looks like there is already some debounce logic here, so I’m not sure if there’s an easy solution…

(Jeff Atwood) #2

Maybe @joffreyjaffeux can take a peek.

(Joffrey Jaffeux) #3

never experienced this, will try to reproduce and concatenate the string in a better order. :grin:

(Jorge Manrubia) #5

I gave that a try out of curiosity and, indeed, I can reproduce the issue in Chrome with CPU throttling as @David_Taylor mentioned. For me, replacing this line:


this.$list.css('visibility', 'hidden');

That fixed the problem for me. I know that visibility: hidden is more performant than display: none because it won’t cause a reflow, but no idea about why that is having such impact here (maybe this old chrome bug is still around?). Also, I don’t know if the visibility: hidden will introduce other unwanted side effects, but seems to work fine.

It was not a JQuery’s hide() thing. this.$list.css('display', 'none') was as slow as this.$list.hide().

(Joffrey Jaffeux) #6

seems like a right path, I will investigate monday if we can’t do anything better and if it has implications. thx.

(Joffrey Jaffeux) #7

I just merged a fix (still awaiting deploy on meta):

Thx @David_Taylor and @jorge_manrubia.

Now more details on this:

  • I follow your advice and went for visibility. I applied it explicitly when making it visible too.
  • I was also thinking of the initial thought of david: “there’s already debouncing…” So I bumped the debouncing timeout on mobile a little bit, my thought behind this being there’s probably more delay when you backspace on mobile than on desktop, so the chances you trigger multiple rendering when you just want to delete multiple chars were higher on mobile.
  • I also took this opportunity for a small refactoring and changing the modal positioning on mobile, I actually made it look like it’s a panel at the top, I think it’s a good improvement and should avoid it from going under keyboard, let me know what you think:

(Joffrey Jaffeux) #8

This topic was automatically closed after 30 hours. New replies are no longer allowed.