Skip to content

Conversation

@FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Oct 7, 2025

Stop creating Error and passing into assert, especially in hot paths as it takes a significant amount of time on mobile.


Note

Replaces assert(..., new Error(...)) with string messages in SnapController and Timer to avoid unnecessary Error construction.

  • Performance refactor
    • packages/snaps-controllers/src/snaps/SnapController.ts
      • Use assert(condition, "message") instead of creating Error in getExpect, #createRollbackSnapshot (2 sites), and #getRuntimeExpect.
    • packages/snaps-controllers/src/snaps/Timer.ts
      • Same change in cancel, finish, pause, start, and resume.

Written by Cursor Bugbot for commit 8c15196. This will update automatically on new commits. Configure here.

@FrederikBolding FrederikBolding requested a review from a team as a code owner October 7, 2025 08:27
@codecov
Copy link

codecov bot commented Oct 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.29%. Comparing base (93f69e5) to head (8c15196).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3664   +/-   ##
=======================================
  Coverage   98.29%   98.29%           
=======================================
  Files         417      417           
  Lines       11907    11907           
  Branches     1848     1848           
=======================================
  Hits        11704    11704           
  Misses        203      203           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FrederikBolding FrederikBolding added this pull request to the merge queue Oct 7, 2025
Merged via the queue into main with commit 03d964d Oct 7, 2025
122 checks passed
@FrederikBolding FrederikBolding deleted the fb/dont-create-error-prematurely branch October 7, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants