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

[performance] - Can target registries be lazy loaded? #11570

Open
jasonwilliams opened this issue Jan 2, 2025 · 3 comments
Open

[performance] - Can target registries be lazy loaded? #11570

jasonwilliams opened this issue Jan 2, 2025 · 3 comments
Labels
bug It's a bug

Comments

@jasonwilliams
Copy link
Contributor

jasonwilliams commented Jan 2, 2025

Operating system

Windows

Joplin version

Joplin 3.2.6

Desktop version info

Joplin 3.2.6 (dev, win32)

Client ID: 4592d91627554b8f9f896c8c23b60f91
Sync Version: 3
Profile Version: 47
Keychain Supported: Yes

Revision: 2b43a9a (dev)

Backup: 1.4.2
Freehand Drawing: 2.13.0

Current behaviour

Over time more JavaScript has been added to Joplin's critical path to an initial render. One of those scripts which are quite heavy is SyncTargetAmazonS3.js. This is a development build below but it seems to take up a chunk of time just in the parsing of itself and it's dependencies, which seems proportional considering most people won't be using this utility at all.

Trace

Trace-Joplin-Dev-20250102T175540.json

image

Expected behaviour

I wonder if the registry entries need to be loaded this early on and block rendering, or is there a delayed time we can add these in later on?

It may be an idea to have some hook which fires after initial render which can dynamically import these entries.

I don't know for sure how early these are needed though

Debugging setup

I used this so I could debug both the main process and the renderer process in VS Code, let me know if you want me to add it to the documentation somewhere
https://gist.github.com/jasonwilliams/6ebf25e97998e99ca32eb96ee4cceb6c

Logs

No response

@jasonwilliams jasonwilliams added the bug It's a bug label Jan 2, 2025
@sanyamhbtu
Copy link

Hello sir! @jasonwilliams . Can we fix it by dynamically import the heavy script after the initial render. Like use of UseEffect hook .

@jasonwilliams
Copy link
Contributor Author

@sanyamhbtu yes absolutely! I don’t know if Joplin has a centralised “everything has rendered” API where lower priority tasks can run, or you can just move this to the useEffect, but either way, dynamically importing these will help a lot.

Some electron apps (like VS Code for e.g) have a global event which fires once the core app is rendered.

@sanyamhbtu
Copy link

@jasonwilliams Thanks for the confirmation! I agree, using a central event or a global hook for determining when the app is fully rendered would be ideal. If Joplin has a similar event or API, I’ll hook into that. If not, I can go ahead and use useEffect to dynamically import the script after the initial render. I’ll give this approach a try and keep you updated on the progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug
Projects
None yet
Development

No branches or pull requests

2 participants