jsumners / alfred-emoji

Alfred workflow for searching and copying emoji
741 stars 32 forks source link

Use packed emoji #69

Closed jsumners closed 2 years ago

jsumners commented 2 years ago

I'm not sure how this is going to be possible. The idea is to create mapped emoji data for faster searching. But in order to serialize the data and rehydrate it quickly at run time, we need access to the file system. I don't think JXA has anything that we can shim into the code to make this happen. It might be time to investigate various methods of integrating https://github.com/bellard/quickjs into the build.

jsumners commented 2 years ago

Hmm, "wink" is only returning 😜.

jsumners commented 2 years ago

I'm going to go ahead and merge this and tag it for posterity. It's at least as fast as the current implementation on master. But it's clear to me that we need to serialize to plain JavaScript objects instead of Maps to avoid the multiple layers of decoding necessary on startup. We also really can't make use of the Map features for searching, as shown by the "wink" results.

devnoname120 commented 2 years ago

@jsumners Tangentially, startup time is a bit too slow for me. Usually I press the emoji shortcut then start typing straight away, e.g. ‶wink″. Usually the box takes too much time to load so it types ‶w″ in the field, and ‶ink″ in the emoji search bar.

I haven't profiled the workflow so I'm not sure why it takes time to start up. Would it be possible to asynchronously load everything so that the search box appears straight away? Results would then start appearing after something like 200ms.

jsumners commented 2 years ago

@devnoname120 I don't quite follow what you are saying. I:

  1. press cmd+space to bring up Alfred
  2. type "emoji" and press enter
  3. start typing "wink" and get results

Please try the latest release and file a new issue if you still have problems with it.

devnoname120 commented 2 years ago

@jsumners I directly open the menu by pressing a hotkey:

image

Here is a video that illustrates my issue:

https://user-images.githubusercontent.com/2824100/151878878-6f543da4-d68b-47f3-b848-d53e457e93a2.mov

In the video, I'm pressing Cmd+Control+c and then I type wink. The input bar doesn't appear fast enough so some letters are not captured. I suspect that this latency may be due to some kind of warmup. I don't have that issue with the general Alfred bar, it appears straight away.

Currently I'm using emoji v2, it's considerably worse on #66. Unsure about the latest improvements. I'll try the latest version and report back.