Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(NcEmojiPicker): open x1.5-x2 faster + doesn't impact page loading #6467

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ShGKme
Copy link
Contributor

@ShGKme ShGKme commented Jan 27, 2025

Improving NcEmojiPicker: part 3 of 3

☑️ Resolves

🥱 Boring details | Part 1: initial load 👇

NcEmojiPicker requires creating EmojiIndex with blocks the main thread for about 100ms or more!

We already improved it by:

  • Making it only once (instead of every component instance 😵)
  • Making it in setup (not blocking initial Nextcloud app loading)

However, it still blocks the main thread app to 100ms once there is the picker on the page...

Improvement (except Safari) - using requestIdleCallback.

In the best case - no blocking anymore at all.

In the worth case (it's Safari, or EmojiPicker renders initially) - works as in the past.

🏚️ Before 🏡 After
image image
🥱 Boring details | Part 2: opening 👇

Opening NcEmojiPicker is slow... But why? 🤔

  • Empty NcPopover is quite fast (30ms)
  • Raw emoji-mart-vue-fast is relatively acceptable (50-60ms)
Empty NcPopover Raw emoji-mart-vue-fast
~30ms ~60ms
Empty-NcPopover Raw-emoji-mart-vue-fast

But opening NcEmojiPicker = NcPopover + emoji-mart-vue-fast is 🐌 SLOW, up to:

  • 160ms..200ms - clean open
  • 120ms..150ms - quick reopen (optimized by NcPopover)

image

NcEmojiPicker

It looks like floating-vue (NcPopover) first renders everything, when makes it "hiddenly visible) to get size and calculate position, and then renders it visually. It causes unneeded reflow, slightly blocking the process (even on optimized reopening, when everything is in DOM already).

A solution - mount NcPopover with dummy empty div with the same size, and then render emoji-mart-vue-fast into a prepared container.

NcEmojiPicker - new

🏚️ Before 🏡 After
Clean open Clean open
200ms 95ms
image image
Quick reopen (optimized by NcPopover) .
100ms (even without Picker mounting!!!) 65ms full remount
image image

🖼️ Screenshots

Useless gifs. Better to test in real app like Talk
🏚️ Before 🏡 After
Clean open .
before-clean after-clean
Quick reopen
before-reopen after-reopen

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • 📘 Component documentation has been extended, updated or is not applicable
  • 3️⃣ Backport to next requested with a Vue 3 upgrade

@ShGKme ShGKme added bug Something isn't working 2. developing Work in progress feature: emoji picker Related to the emoji picker component labels Jan 27, 2025
@ShGKme ShGKme added this to the 8.23.0 milestone Jan 27, 2025
@ShGKme ShGKme self-assigned this Jan 27, 2025
@ShGKme
Copy link
Contributor Author

ShGKme commented Jan 27, 2025

Arr, gifs are not in sync

@szaimen szaimen removed their request for review January 28, 2025 09:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress bug Something isn't working feature: emoji picker Related to the emoji picker component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emoji picker tab wrong after opening again
1 participant