Skip to content

Conversation

infiniteflower
Copy link
Contributor

@infiniteflower infiniteflower commented Aug 23, 2024

Description

This PR removes Web3 in favor of just using Ethers to read values off a contract.

This has resulted in the following performance improvements:

With Web3 No Web3 Perf improvement
App Start 4920ms 658ms ~86% decrease
Logcat 6929ms ~2500ms ~63% decrease

App start and Logcat are 2 related but different measurements. Logcat is more closely related to visually looking at the app and seeing when it starts up.

Related issues

Fixes: #10611
Related to: MetaMask/swaps-controller#293

Manual testing steps

You will need to run the QA build of the Android app onto a physical device to measure performance changes accurately.

  1. android/app/build.gradle
    1. Comment out line 3: apply plugin: "io.sentry.android.gradle"
    2. Comment out line 62 to 100 to get rid of Sentry (starts with // Sentry environment variables used by Sentry CLI to upload files. Upload is disabled by default)
    3. Line 242: change to signingConfigs.debug
  2. Connect a physical Android device to your machine.
  3. Run this command to build and install onto your physical device: cd ./android && ./gradlew assembleQaRelease -PminSdkVersion=26 -DtestBuildType=release -x app:createBundleFlaskDebugJsAndAssets && cd ../ && adb install -r android/app/build/outputs/apk/qa/release/app-qa-release.apk

Testing

  1. Start the Android app
  2. Notice how much faster it got
  3. Go to Swaps
  4. Select From token as an ERC20 which requires allowance
  5. Get a quote
  6. Notice Edit Limit
    1. Select From token as an ERC20 which doesn't requires allowance
  7. Get a quote
  8. Notice Edit Limit is not there

Screenshots/Recordings

Before

After

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.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@github-actions github-actions bot added the team-swaps-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead label Aug 23, 2024
@infiniteflower infiniteflower changed the title Chore/swaps android perf chore: Improve startup times on Android through Swaps Aug 23, 2024
@infiniteflower infiniteflower changed the title chore: Improve startup times on Android through Swaps chore: Improve startup times on Android through Swaps changes Aug 23, 2024
@infiniteflower infiniteflower changed the base branch from main to swaps/basecontrollerv2 August 23, 2024 19:58
@Cal-L
Copy link
Contributor

Cal-L commented Sep 4, 2024

Resolved already

@Cal-L Cal-L closed this Sep 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2024
@infiniteflower infiniteflower reopened this Sep 4, 2024
@infiniteflower
Copy link
Contributor Author

infiniteflower commented Sep 4, 2024

@Cal-L We still need this PR for when we bump SwapsController to v10, If we could keep it open that would be great.

@infiniteflower infiniteflower marked this pull request as ready for review September 23, 2024 13:50
@infiniteflower infiniteflower requested a review from a team September 23, 2024 13:50
@infiniteflower infiniteflower added team-swaps-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead Run Smoke E2E Requires smoke E2E testing and removed team-swaps-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead labels Sep 23, 2024
@infiniteflower infiniteflower requested review from a team as code owners November 19, 2024 23:43
Base automatically changed from swaps/basecontrollerv2 to main November 20, 2024 19:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Run Smoke E2E Requires smoke E2E testing team-swaps-deprecated DEPRECATED: please use "team-swaps-and-bridge" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

App Performance Start-Up: Swap Optimizations

3 participants