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

Cache and prefetch shield files #365

Merged
merged 9 commits into from
Jul 27, 2024

Conversation

Duddino
Copy link
Member

@Duddino Duddino commented May 2, 2024

Abstract

When creating or loading a shield wallet, a bunch of helper scripts are fetched from the server sequentially. This happens one time for each thread.
Even though they're cached, a request is still sent to the server to see if the file changed, this creates a noticeable between creating a wallet and getting to the dashboard, particularly on machines with a high number of cores, and/or with a high network latency.

This PR aims to prefetch the required shield files, before they're actually needed. The idea is that by the time someone has created and backed up their seedphrase, the browser would have already fetched the files.
Additionally, this PR adds the util scripts each worker needs in the sapling cache to avoid contacting the server for each worker.

Testing

  • Have a third world connection (or simulate it using the devtools)
  • Open MPW and try to create a new wallet or import an existing one, and see if there is any noticeable lag

@Duddino Duddino self-assigned this May 2, 2024
Copy link

netlify bot commented May 2, 2024

Deploy Preview for cheery-moxie-4f1121 ready!

Name Link
🔨 Latest commit c71fed4
🔍 Latest deploy log https://app.netlify.com/sites/cheery-moxie-4f1121/deploys/66a3989589f1e000088111f1
😎 Deploy Preview https://deploy-preview-365--cheery-moxie-4f1121.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Duddino Duddino marked this pull request as draft May 2, 2024 14:29
@Duddino Duddino marked this pull request as ready for review May 2, 2024 15:02
Copy link
Member

@panleone panleone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice PR

scripts/native-worker.js Outdated Show resolved Hide resolved
scripts/native-worker.js Outdated Show resolved Hide resolved
@panleone panleone added the Enhancement New feature or request label May 3, 2024
panleone
panleone previously approved these changes May 6, 2024
Copy link
Member

@panleone panleone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK e6191be

Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Receiving error after simply opening the page, Firefox on Linux.

Uncaught (in promise) TypeError: registration.active is null
    registerWorker native.js:15

image

panleone
panleone previously approved these changes Jul 19, 2024
Copy link
Member

@panleone panleone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK b3c1e7e

noticeably faster than the master branch

@panleone panleone requested a review from JSKitty July 19, 2024 07:54
@Duddino Duddino requested review from JSKitty and removed request for JSKitty July 23, 2024 13:23
Copy link
Member

@JSKitty JSKitty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK c71fed4

Took a few attempts for my configuration, but undeniably faster loading speed now. Happy this was taken care of. 🙏

@panleone panleone merged commit 7cbc5e3 into PIVX-Labs:master Jul 27, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants