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

fix: improve performance in large signature request confirmations #26209

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Jul 29, 2024

Description

Improve the performance when rendering large signature request confirmations.

After profiling within the browser, this appeared to ultimately be caused by the token list selectors which were firing repeatedly on the un-memoized token list, and in turn repeatedly converting it to a list and then comparing keys one at a time via a find.

This PR optimises those selectors using deep equal comparison and alternate selectors when the remote token list should always be used. In addition, case insensitive comparison should not be needed since both the remote and static token lists use lowercase addresses.

Open in GitHub Codespaces

Related issues

Fixes: #26129

Manual testing steps

See issue.

Screenshots/Recordings

Before

legacy_before.mov
redesigned_before.mov

After

legacy_after.mov
redesigned_after.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@matthewwalsh0 matthewwalsh0 added the team-confirmations Push issues to confirmations team label Jul 29, 2024
@matthewwalsh0 matthewwalsh0 requested review from a team as code owners July 29, 2024 23:16
jpuri
jpuri previously approved these changes Jul 29, 2024
Copy link

Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 92.59259% with 4 lines in your changes missing coverage. Please review.

Project coverage is 69.97%. Comparing base (fe11329) to head (ec23860).
Report is 1 commits behind head on develop.

Files Patch % Lines
ui/components/app/name/name.tsx 87.50% 3 Missing ⚠️
ui/components/app/confirm/info/row/address.tsx 92.31% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26209      +/-   ##
===========================================
- Coverage    69.98%   69.97%   -0.00%     
===========================================
  Files         1409     1409              
  Lines        49856    49849       -7     
  Branches     13779    13778       -1     
===========================================
- Hits         34887    34880       -7     
  Misses       14969    14969              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [ec23860]
Page Load Metrics (134 ± 151 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint6112593189
domContentLoaded106022126
load421507134315151
domInteractive106022126
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 15 Bytes (0.00%)
  • common: -188 Bytes (-0.00%)

@seaona
Copy link
Contributor

seaona commented Jul 30, 2024

I confirm I also see a massive improvement in both cases now 🔥

perf-fix-singatures.mp4

@matthewwalsh0 matthewwalsh0 merged commit 3c11ac3 into develop Jul 30, 2024
75 checks passed
@matthewwalsh0 matthewwalsh0 deleted the fix/large-signature-performance branch July 30, 2024 09:17
@github-actions github-actions bot locked and limited conversation to collaborators Jul 30, 2024
@metamaskbot metamaskbot added the release-12.4.0 Issue or pull request that will be included in release 12.4.0 label Jul 30, 2024
@gauthierpetetin gauthierpetetin added release-12.3.0 Issue or pull request that will be included in release 12.3.0 and removed release-12.4.0 Issue or pull request that will be included in release 12.4.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.3.0 Issue or pull request that will be included in release 12.3.0 team-confirmations Push issues to confirmations team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Signatures - Huge performance degradation with long messages
6 participants