leapchat
leapchat copied to clipboard
Performance - Speed up initialization of app
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.
This looks promising: http://threadsjs.readthedocs.io/en/latest/
@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.
Startup/init feels slow to me only on Firefox on Android. Where does it feel slow to you?
Maybe we can utilize web workers for the long running crypto stuff?
@Spetastian Yes, we looked into web workers a bit -- I haven't used them in production -- and they seem like a good solution
@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:
- On app init (generating keypair from passphrase)
- Right after app init (decrypting all the just-downloaded messages)
- (Once we have multi-room support) Upon loading any room not recently viewed (similar to point 2, above)
- (In Ensue/Pursuance) When loading a new pursuance's task hierarchy (and therefore a bunch of tasks -- potentially dozens)
The solution: https://github.com/dchest/nacl-stream-js/tree/master/demo
Turns out nacl-stream
is already a miniLock dependency!
Partially solved this by adding gzip compression in b3ae8bce533b3e641b4fe18c332d1d8aee25dcc9