Skip to content

refactor: speed up initial page load#566

Merged
dergigi merged 19 commits intomasterfrom
refactor/speed-up-initial-page-load
Dec 9, 2022
Merged

refactor: speed up initial page load#566
dergigi merged 19 commits intomasterfrom
refactor/speed-up-initial-page-load

Conversation

@theborakompanioni
Copy link
Collaborator

@theborakompanioni theborakompanioni commented Nov 7, 2022

Resolves #356.
Based on #564.

Note: This is based on #564 - you can either review them separately or just review this one. Be aware that the change set is rather large. Unfortunately, this could not be avoided due to the deep impact of the new behaviour on nearly all components.

Before this commit, a request to API endpoint /display was always triggered on almost every page load.
After this commit, the request to /display is made when necessary.

Users have reported that on mainnet, this request alone can take up to ~20 seconds!
The speed increase is also very noticeable on regtest in your dev environment.

Behaviour before

Requests to /display were done when:

  • After initial loading of wallet
  • navigating to MainWalletView
  • navigating to Send
  • navigating to Earn
  • navigating to Jam
  • freezing/unfreezing of UTXOs

Behaviour now

Requests to /display are done when:

  • After initial loading of wallet
  • opening JarDetails Overlay
  • attempting to create a Fidelity Bond

However, there are trade-offs! Now, one must know which data is needed on the current screen as opposed to just reloading all data. i.e. if addressSummary is needed, data from /display still has the be loaded.

Also, it can be that the user is not warned when an address is reused. This is the case after sending to an own address. Before, if a second attempt to send to the same address is made, a user has seen a warning. Now, this warning is not displayed anymore. It can be mitigated by also scanning the UTXO addresses (not done in this PR!).

How to test

You can compare new and past behaviour by clicking through the UI on localhost:3000 (new behaviour) and on localhost:29080 (past v0.1.2 behaviour). If you open these in two windows next to each other, the speed increase becomes apparent.

@theborakompanioni theborakompanioni added performance Performance and/or speed improvements refactoring Code refactoring without functional changes labels Nov 7, 2022
@theborakompanioni theborakompanioni self-assigned this Nov 7, 2022
@theborakompanioni theborakompanioni marked this pull request as ready for review November 7, 2022 18:23
@dergigi
Copy link
Contributor

dergigi commented Nov 17, 2022

@theborakompanioni I assumed that #564 could be merged and that there would be no conflicts with this PR. Turns out the assumption was wrong. To avoid this in the future, we could change the base branch of cascading PRs?

In any case, I will review this again after conflicts are resolved.

@theborakompanioni
Copy link
Collaborator Author

@theborakompanioni I assumed that #564 could be merged and that there would be no conflicts with this PR. Turns out the assumption was wrong. To avoid this in the future, we could change the base branch of cascading PRs?

I thought so too. My fault. Yes, will change base branches of cascading PRs from now on. Sorry for the delay.

In any case, I will review this again after conflicts are resolved.

Conflicts are resolved.

Copy link
Contributor

@dergigi dergigi left a comment

Choose a reason for hiding this comment

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

Finally managed to review and test this PR, apologies for the delay.

Looks good to me, and I didn't run into any issues while testing. Performance improvement is substantial! Well done 🙌

tACK ✅

@dergigi dergigi merged commit e2bad18 into master Dec 9, 2022
@dergigi dergigi deleted the refactor/speed-up-initial-page-load branch December 9, 2022 09:14
@dergigi dergigi mentioned this pull request Dec 9, 2022
dergigi added a commit that referenced this pull request Dec 14, 2022
dergigi added a commit that referenced this pull request Dec 14, 2022
* chore(release): v0.1.4

* docs: add #566 to CHANGELOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance and/or speed improvements refactoring Code refactoring without functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Question: How to prevent loading /display and /utxos on most pages

2 participants