Skip to content

Conversation

@MajorLift
Copy link
Contributor

@MajorLift MajorLift commented Oct 23, 2025

Description

// ❌ BROKEN: this will not memoize correctly, and does nothing useful!
const brokenSelector = createSelector(
  state => state.todos,
  todos => todos
)

Any "output selector" that just returns its inputs is incorrect! The output selector should always have the transformation logic.

Similarly, a memoized selector should never use state => state as an input! That will force the selector to always recalculate.

-- https://redux.js.org/usage/deriving-data-selectors#createselector-overview

Open in GitHub Codespaces

Changelog

CHANGELOG entry:

Related issues

Manual testing steps

  1. Go to this page...

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.

@github-actions
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.

@metamaskbot metamaskbot added the team-extension-platform Extension Platform team label Oct 23, 2025
@metamaskbot
Copy link
Collaborator

metamaskbot commented Oct 23, 2025

✨ Files requiring CODEOWNER review ✨

🫰 @MetaMask/core-platform (3 files, +5 -18)
  • 📁 ui/
    • 📁 hooks/
      • 📁 snaps/
        • 📄 useDisplayName.ts +2 -2
    • 📁 pages/
      • 📁 snaps/
        • 📁 snap-view/
          • 📄 snap-settings.js +2 -2
    • 📁 selectors/
      • 📁 snaps/
        • 📄 accounts.ts +1 -14

@MajorLift MajorLift changed the title fix: non-functional memoization in getInternalAccounts selector fix(perf): nonfunctional memoization in getInternalAccounts selector Oct 23, 2025
@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 109550a | Date: 10/23/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.06s (±76ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 743ms (±72ms) 🟢 | historical mean value: 737ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±16ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.06s 76ms 1.02s 1.42s 1.30s 1.42s
domContentLoaded 743ms 72ms 704ms 1.06s 959ms 1.06s
firstPaint 79ms 16ms 60ms 232ms 84ms 232ms
firstContentfulPaint 79ms 16ms 60ms 232ms 84ms 232ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [109550a]
UI Startup Metrics (1238 ± 73 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1238110214337312941370
load106494512657211161178
domContentLoaded105894212597211091172
domInteractive191396101739
firstPaint64589119443510851168
backgroundConnect2282172678231244
firstReactRender26174762739
getState19780102234
initialActions60689612
loadScripts836722103571888946
setupStore1063131015
BrowserifyPower User HomeuiStartup22231859356251724973562
load1168927202135316272021
domContentLoaded1158921200635116232006
domInteractive34141243253124
firstPaint77518820145359792014
backgroundConnect25722447357252473
firstReactRender22192622226
getState20315824422217244
initialActions72368536
loadScripts912703154231013771542
setupStore1172641126
WebpackStandard HomeuiStartup9017631184739131082
load67161498671678867
domContentLoaded66360797469670859
domInteractive17127091541
firstPaint19158978198175769
backgroundConnect26146593045
firstReactRender29174983538
getState1362241520
initialActions4115258
loadScripts65960596067667846
setupStore1152031316
WebpackPower User HomeuiStartup18581424266140324762661
load800631139522610291395
domContentLoaded75261712561749121256
domInteractive261396214296
firstPaint5337112603829491260
backgroundConnect12821453150328453
firstReactRender22202412324
getState18912123423202234
initialActions918119581
loadScripts74761512431709001243
setupStore18747122547
FirefoxBrowserifyStandard HomeuiStartup15621331201412916191810
load1328115216338913851482
domContentLoaded1327115216338913851482
domInteractive1233733853140247
firstPaint------
backgroundConnect4324151195090
firstReactRender27226772739
getState9417617916
initialActions4116249
loadScripts1300113415988513551439
setupStore157211211328
BrowserifyPower User HomeuiStartup27422329399041628583990
load14321186199518315011995
domContentLoaded14321185199518315001995
domInteractive1504039391236393
firstPaint------
backgroundConnect23046912230411912
firstReactRender352664104264
getState1667534356191343
initialActions61205820
loadScripts13571135165913314391659
setupStore4171333876133
WebpackStandard HomeuiStartup15971426221011816361855
load1369121315857914211518
domContentLoaded1368121215857914201518
domInteractive1043137546112189
firstPaint------
backgroundConnect46241462248105
firstReactRender282177102759
getState123162241056
initialActions41537317
loadScripts1339119315167213921476
setupStore177187211356
WebpackPower User HomeuiStartup29072398392341830533923
load16271332217922217852179
domContentLoaded16261332217822217842178
domInteractive15136384100210384
firstPaint------
backgroundConnect23539977263303977
firstReactRender37284774547
getState1488622036158220
initialActions713071230
loadScripts15711289200820017382008
setupStore3281043145104
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.24 KiB (0.05%)
  • ui: 1.43 KiB (0.02%)
  • common: -425 Bytes (0%)

@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 2578a44 | Date: 10/23/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±73ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 735ms (±71ms) 🟢 | historical mean value: 735ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±13ms) 🟢 | historical mean value: 77ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 73ms 1.01s 1.32s 1.30s 1.32s
domContentLoaded 735ms 71ms 697ms 1.00s 969ms 1.00s
firstPaint 76ms 13ms 56ms 188ms 84ms 188ms
firstContentfulPaint 76ms 13ms 56ms 188ms 84ms 188ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [2578a44]
UI Startup Metrics (1269 ± 85 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup1269109115148513261412
load108995512958111491232
domContentLoaded108192712898211411224
domInteractive201474101847
firstPaint68677128645311281225
backgroundConnect23522036817236257
firstReactRender2817102113246
getState20786102237
initialActions51355719
loadScripts854697106282914997
setupStore1062131016
BrowserifyPower User HomeuiStartup23321929399660628053996
load1204955201134416492011
domContentLoaded1195948200234116382002
domInteractive43162155058215
firstPaint729174175651510081756
backgroundConnect27022458388263583
firstReactRender25204562545
getState20718126522223265
initialActions1831062729106
loadScripts952720162731113861627
setupStore1473581435
WebpackStandard HomeuiStartup8617361146728861000
load64359592963649787
domContentLoaded63558792063641781
domInteractive16116081537
firstPaint17857887168193619
backgroundConnect23114462736
firstReactRender28166693342
getState1252441517
initialActions3014357
loadScripts63258490761638770
setupStore1052541217
WebpackPower User HomeuiStartup17431336251235122212512
load699614941109840941
domContentLoaded67359784691799846
domInteractive201352112352
firstPaint45474858311812858
backgroundConnect10822348114266348
firstReactRender22193022230
getState17513920315179203
initialActions7030101330
loadScripts66859583386787833
setupStore22670212670
FirefoxBrowserifyStandard HomeuiStartup16041413206212616501946
load1343117115197113961476
domContentLoaded1343117015197113961476
domInteractive1193635044127202
firstPaint------
backgroundConnect5027141205689
firstReactRender28235262842
getState115198231017
initialActions6220120414
loadScripts1312114914816813511446
setupStore197193241581
BrowserifyPower User HomeuiStartup27872358370935230293709
load14451195174916116091749
domContentLoaded14451194174916216091749
domInteractive1455227375225273
firstPaint------
backgroundConnect18636534182449534
firstReactRender36285074550
getState1699441370189413
initialActions11171191071
loadScripts14031170166815015531668
setupStore3051182846118
WebpackStandard HomeuiStartup16921464253415117621970
load14511256180810815351645
domContentLoaded14501256180810815341645
domInteractive1233547979126364
firstPaint------
backgroundConnect4626123175281
firstReactRender302285103041
getState114221221017
initialActions7121022419
loadScripts14221229177410614961619
setupStore1465571426
WebpackPower User HomeuiStartup30002398433358336194333
load16781391211025420172110
domContentLoaded16781390211025420162110
domInteractive1245122451171224
firstPaint------
backgroundConnect25535903306710903
firstReactRender35274763947
getState1626624048216240
initialActions822671326
loadScripts15991365194418917271944
setupStore4472495764249
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 2.24 KiB (0.05%)
  • ui: 1.42 KiB (0.02%)
  • common: -576 Bytes (-0.01%)

@MajorLift MajorLift force-pushed the jongsun/perf/redux/251023-fix-reselect-selectors-accounts branch from 2578a44 to 836d106 Compare November 14, 2025 20:27
@metamaskbot
Copy link
Collaborator

Builds ready [836d106]
UI Startup Metrics (1267 ± 104 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup12671097166610413461423
load110094713629811781252
domContentLoaded109392813459811711248
domInteractive231589171975
firstPaint62087132244411141211
backgroundConnect23922333512242254
firstReactRender30208593250
getState21769102435
initialActions108112
loadScripts8616901088989451014
setupStore1162331217
numNetworkReqs1367519671
BrowserifyPower User HomeuiStartup22521710312430124183124
load1180991185924013951859
domContentLoaded1160975184524313881845
domInteractive601720962123209
firstPaint668212188150910481881
backgroundConnect25323229818262298
firstReactRender74511251983125
getState25716235957314359
initialActions102122
loadScripts930752157623411561576
setupStore2874083440
numNetworkReqs12510019128150191
WebpackStandard HomeuiStartup8367101189958351071
load60956095872607824
domContentLoaded60155592768602795
domInteractive181170131554
firstPaint19260887173198583
backgroundConnect251076153162
firstReactRender3719317383662
getState1154441216
initialActions103111
loadScripts59855391665599782
setupStore1253461331
numNetworkReqs1367519871
WebpackPower User HomeuiStartup1118928161223614251612
load67157510171417891017
domContentLoaded652565978130752978
domInteractive321389318189
firstPaint35366982289575982
backgroundConnect581616759146167
firstReactRender41365344353
getState1449319128164191
initialActions101011
loadScripts648563968127742968
setupStore1362682526
numNetworkReqs846313828129138
FirefoxBrowserifyStandard HomeuiStartup14811312198213415281774
load1249113116009712901478
domContentLoaded1249113116009712901478
domInteractive55332063854165
firstPaint------
backgroundConnect4224166214888
firstReactRender27234752841
getState127100101120
initialActions208122
loadScripts1225111315649112631437
setupStore13766101331
numNetworkReqs1267316756
BrowserifyPower User HomeuiStartup32592606461060639114610
load15131264182619617691826
domContentLoaded15121263182619617691826
domInteractive27694577184547577
firstPaint------
backgroundConnect563108127442510341274
firstReactRender896511814103118
getState180108532100187532
initialActions213123
loadScripts14721228177119217421771
setupStore11814530138122530
numNetworkReqs1278023057222230
WebpackStandard HomeuiStartup16441480243820316322257
load13741229169810413961670
domContentLoaded13731228169810413961669
domInteractive55312042863120
firstPaint------
backgroundConnect55224065353149
firstReactRender33258393543
getState178208311149
initialActions217123
loadScripts1341118516258913741570
setupStore2372534512107
numNetworkReqs1366918765
WebpackPower User HomeuiStartup33152665417245737414172
load16701457205419218822054
domContentLoaded16701457205319118812053
domInteractive22178538165454538
firstPaint------
backgroundConnect438115947241670947
firstReactRender905214323107143
getState18011747884219478
initialActions51358335
loadScripts16281411198619318531986
setupStore913815838127158
numNetworkReqs1267723157215231
📊 Page Load Benchmark Results

Current Commit: 836d106 | Date: 11/14/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±39ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±36ms) 🟢 | historical mean value: 718ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 77ms (±12ms) 🟢 | historical mean value: 77ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 39ms 1.02s 1.33s 1.09s 1.33s
domContentLoaded 724ms 36ms 706ms 988ms 763ms 988ms
firstPaint 77ms 12ms 60ms 176ms 92ms 176ms
firstContentfulPaint 77ms 12ms 60ms 176ms 92ms 176ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 58 Bytes (0%)
  • ui: -134 Bytes (0%)
  • common: -105 Bytes (0%)

@MajorLift MajorLift force-pushed the jongsun/perf/redux/251023-fix-reselect-selectors-accounts branch from 836d106 to 4bbda9a Compare November 25, 2025 14:14
@metamaskbot
Copy link
Collaborator

Builds ready [4bbda9a]
UI Startup Metrics (1377 ± 132 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyStandard HomeuiStartup13771099177813214561621
load1102907134610811681303
domContentLoaded1096901133910711541297
domInteractive30151422823109
firstPaint48010313504059691278
backgroundConnect22619827814231256
firstReactRender37237294254
getState63201672573125
initialActions106114
loadScripts87769810901039431060
setupStore1574671730
numNetworkReqs41281453330142
BrowserifyPower User HomeuiStartup22941884359729724242853
load1046911207317210431434
domContentLoaded1031897206217210251414
domInteractive41172244433152
firstPaint5787920714249741429
backgroundConnect268210690108249547
firstReactRender944516324112134
getState19914082086203252
initialActions105112
loadScripts81869618521728101206
setupStore231068122751
numNetworkReqs1407038572183293
WebpackStandard HomeuiStartup8557271155988771104
load63555788380667835
domContentLoaded63155387579662827
domInteractive2615105222292
firstPaint24499881168233621
backgroundConnect953041017
firstReactRender37201862537100
getState51181402764102
initialActions108113
loadScripts62855186677660819
setupStore15562101838
numNetworkReqs41271483430145
WebpackPower User HomeuiStartup18691448245523820222324
load6795871018102683942
domContentLoaded6685801013103672934
domInteractive36172243333120
firstPaint32279957210421699
backgroundConnect90862417428568
firstReactRender934815823112125
getState17612972159180219
initialActions103112
loadScripts6665781004101670932
setupStore21656132448
numNetworkReqs1526839874195369
FirefoxBrowserifyStandard HomeuiStartup14071173213819115141809
load105793513359311201237
domContentLoaded105693113359311201236
domInteractive53301712872103
firstPaint------
backgroundConnect65254586363171
firstReactRender281974103353
getState289185272769
initialActions105122
loadScripts103192113158310811202
setupStore2411139202460
numNetworkReqs40281282732122
BrowserifyPower User HomeuiStartup26792078463147627554057
load1127954231718211541444
domContentLoaded1126954231718211531444
domInteractive1133344585109367
firstPaint------
backgroundConnect1243057292141379
firstReactRender86383214190126
getState26957900190298724
initialActions207123
loadScripts1094934224617411071400
setupStore1716728193189665
numNetworkReqs101613096280254
WebpackStandard HomeuiStartup16331376207217517471978
load12731081151210313411468
domContentLoaded12721081151210313411468
domInteractive59282163480108
firstPaint------
backgroundConnect62221773065136
firstReactRender3322164173446
getState258196242485
initialActions213123
loadScripts1246106514889613141429
setupStore2610265351993
numNetworkReqs39281282733122
WebpackPower User HomeuiStartup30272242547077731074935
load15251137344854115082886
domContentLoaded15251137344854115072886
domInteractive1843016242941111038
firstPaint------
backgroundConnect1742313422591461032
firstReactRender87392873791144
getState334271181268553866
initialActions2035323
loadScripts14311117297541514812577
setupStore1235663147131470
numNetworkReqs101613146378252
📊 Page Load Benchmark Results

Current Commit: 4bbda9a | Date: 11/25/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±41ms) 🟡 | historical mean value: 1.04s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 717ms (±38ms) 🟢 | historical mean value: 722ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 76ms (±10ms) 🟢 | historical mean value: 79ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 41ms 1.00s 1.36s 1.05s 1.36s
domContentLoaded 717ms 38ms 695ms 1.02s 731ms 1.02s
firstPaint 76ms 10ms 56ms 160ms 84ms 160ms
firstContentfulPaint 76ms 10ms 56ms 160ms 84ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 10.6 KiB (0.23%)
  • ui: -371.41 KiB (-5.01%)
  • common: 40.19 KiB (0.46%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-M team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants