leapchat icon indicating copy to clipboard operation
leapchat copied to clipboard

Performance - Speed up initialization of app

Open jimmcgaw opened this issue 7 years ago • 8 comments

To make the app seem more responsive, kick off the user modal while the longer-running crypto tasks run in the background getting the app ready.

jimmcgaw avatar May 08 '17 14:05 jimmcgaw

This looks promising: http://threadsjs.readthedocs.io/en/latest/

jimmcgaw avatar May 09 '17 14:05 jimmcgaw

@jimmcgaw Nice find. LeapChat will eventually also be an Electron app, so something that can do both in-browser stuff and desktop/Node stuff sounds good.

elimisteve avatar May 10 '17 02:05 elimisteve

Startup/init feels slow to me only on Firefox on Android. Where does it feel slow to you?

elimisteve avatar May 23 '17 03:05 elimisteve

Maybe we can utilize web workers for the long running crypto stuff?

Spetastian avatar Jul 18 '17 12:07 Spetastian

@Spetastian Yes, we looked into web workers a bit -- I haven't used them in production -- and they seem like a good solution

elimisteve avatar Jul 18 '17 12:07 elimisteve

@Spetastian Just looked into this further, and web workers sound even more awesome than I'd originally hoped/thought!

Great browser support, and it sounds practical to spawn 4-16 workers when we need that many, which will likely be:

  1. On app init (generating keypair from passphrase)
  2. Right after app init (decrypting all the just-downloaded messages)
  3. (Once we have multi-room support) Upon loading any room not recently viewed (similar to point 2, above)
  4. (In Ensue/Pursuance) When loading a new pursuance's task hierarchy (and therefore a bunch of tasks -- potentially dozens)

elimisteve avatar Aug 02 '17 02:08 elimisteve

The solution: https://github.com/dchest/nacl-stream-js/tree/master/demo

Turns out nacl-stream is already a miniLock dependency!

elimisteve avatar Aug 23 '17 05:08 elimisteve

Partially solved this by adding gzip compression in b3ae8bce533b3e641b4fe18c332d1d8aee25dcc9

elimisteve avatar Feb 12 '23 10:02 elimisteve