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

chore: reduce simple Map/Set ops #9761

Merged
merged 1 commit into from
Mar 12, 2025
Merged

chore: reduce simple Map/Set ops #9761

merged 1 commit into from
Mar 12, 2025

Conversation

runspired
Copy link
Contributor

No description provided.

@runspired runspired added 🎯 canary PR is targeting canary (default) 🏷️ chore This PR primarily refactors code or updates dependencies ci-perf Activates Performance Checks in CI labels Mar 12, 2025
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change is just variable name cleanup. This method is a mega hot-path. I previously benchmarked this multi-tier strategy working better overall than a single-tier strategy + there may later be gains made possible by it in terms of making remote operations flush lazily.

However, we should re-test this assumption at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for small arrays and sets, checking value directly is 30% faster (or more)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the change here is that we use the callback function itself as the token, stashing a bit of info directly on it. This eliminates the double map lookup and simplifies iteration.

We also convert CacheOperations (a simple set) into a direct value comparison.

Copy link

Performance Report for dbe4c43

Scenario - basic-record-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -28ms [-38ms to -19ms] OR -1.88% [-2.53% to -1.27%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [0ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-2ms to 1ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -10ms [-16ms to -4ms] OR -1.22% [-1.98% to -0.51%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [end-record-materialization]
phase estimated improvement -16ms [-21ms to -11ms] OR -4.48% [-5.77% to -3.01%]
☑️ Phase [end-record-materialization] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - complex-record-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -14ms [-19ms to -9ms] OR -1.36% [-1.84% to -0.91%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [0ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-1ms to 2ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -11ms [-15ms to -7ms] OR -1.97% [-2.7% to -1.23%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [end-record-materialization]
phase estimated improvement -3ms [-4ms to -3ms] OR -3.96% [-4.79% to -3.16%]
☑️ Phase [end-record-materialization] => [Test End]
phase no difference [0ms to 0ms]

Scenario - complex-record-materialization-with-relationship-materialization: ✅ Performance improved

✅ duration
phase estimated improvement -15ms [-22ms to -9ms] OR -1.42% [-2.02% to -0.83%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [0ms to 1ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-3ms to 1ms]
✅ Phase [start-push-payload] => [start-peek-records]
phase estimated improvement -12ms [-17ms to -8ms] OR -2.23% [-3.06% to -1.39%]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [start-field-access]
phase estimated improvement -3ms [-4ms to -2ms] OR -3.3% [-4.4% to -2.32%]
☑️ Phase [start-field-access] => [start-relationship-access]
phase no difference [-1ms to 0ms]
☑️ Phase [start-relationship-access] => [end-relationship-access]
phase no difference [0ms to 0ms]
☑️ Phase [end-relationship-access] => [Test End]
phase no difference [0ms to 0ms]

Scenario - relationship-materialization-simple: ☑️ Performance is stable

☑️ duration
phase no difference [-6ms to 1ms]
☑️ Phase [navigationStart] => [start-find-all]
phase no difference [-1ms to 1ms]
✅ Phase [start-find-all] => [start-materialization]
phase estimated improvement -3ms [-5ms to 0ms] OR -1.29% [-2.41% to -0.19%]
☑️ Phase [start-materialization] => [end-materialization]
phase no difference [-3ms to 1ms]
☑️ Phase [end-materialization] => [Test End]
phase no difference [0ms to 1ms]

Scenario - relationship-materialization-complex: ✅ Performance improved

✅ duration
phase estimated improvement -12ms [-22ms to -3ms] OR -0.47% [-0.84% to -0.1%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 0ms]
☑️ Phase [start-data-generation] => [start-push-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-payload] => [start-peek-records]
phase no difference [-2ms to 5ms]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [start-relationship-materialization]
phase estimated improvement -6ms [-8ms to -5ms] OR -4.85% [-5.74% to -4.04%]
☑️ Phase [start-relationship-materialization] => [start-push-payload2]
phase no difference [-10ms to 3ms]
✅ Phase [start-push-payload2] => [start-relationship-materialization2]
phase estimated improvement -4ms [-6ms to -1ms] OR -1.53% [-2.45% to -0.55%]
☑️ Phase [start-relationship-materialization2] => [end-relationship-materialization2]
phase no difference [-2ms to 0ms]
☑️ Phase [end-relationship-materialization2] => [Test End]
phase no difference [-1ms to 1ms]

Scenario - unload: ☑️ Performance is stable

☑️ duration
phase no difference [-5ms to 1ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-payload] => [start-unload-records]
phase no difference [-4ms to 1ms]
☑️ Phase [start-unload-records] => [end-unload-records]
phase no difference [-1ms to 4ms]
☑️ Phase [end-unload-records] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - unload-all: ✅ Performance improved

✅ duration
phase estimated improvement -23ms [-26ms to -18ms] OR -1.87% [-2.18% to -1.54%]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-payload] => [start-materialization]
phase no difference [-2ms to 2ms]
✅ Phase [start-materialization] => [start-unload-all]
phase estimated improvement -8ms [-9ms to -7ms] OR -4.16% [-4.86% to -3.53%]
✅ Phase [start-unload-all] => [end-unload-all]
phase estimated improvement -15ms [-16ms to -13ms] OR -5.1% [-5.64% to -4.52%]
☑️ Phase [end-unload-all] => [Test End]
phase no difference [0ms to 0ms]

Scenario - destroy: ☑️ Performance is stable

☑️ duration
phase no difference [-1ms to 7ms]
☑️ Phase [navigationStart] => [start-push-payload]
phase no difference [-1ms to 0ms]
☑️ Phase [start-push-payload] => [start-destroy-records]
phase no difference [-1ms to 3ms]
⚠️ Phase [start-destroy-records] => [end-destroy-records]
phase estimated regression +1ms [0ms to 3ms] OR +2.52% [0.26% to 5.97%]
☑️ Phase [end-destroy-records] => [Test End]
phase no difference [0ms to 0ms]

Scenario - add-children: ☑️ Performance is stable

☑️ duration
phase no difference [-4ms to 1ms]
☑️ Phase [navigationStart] => [start-push-initial-payload]
phase no difference [0ms to 1ms]
☑️ Phase [start-push-initial-payload] => [start-push-update-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-update-payload] => [end-push-update-payload]
phase no difference [-2ms to 0ms]
☑️ Phase [end-push-update-payload] => [Test End]
phase no difference [0ms to 0ms]

Scenario - unused-relationships: ✅ Performance improved

✅ duration
phase estimated improvement -6ms [-11ms to -1ms] OR -1.5% [-2.95% to -0.17%]
✅ Phase [navigationStart] => [start-push-payload]
phase estimated improvement -3ms [-5ms to -1ms] OR -1.77% [-3.38% to -0.45%]
☑️ Phase [start-push-payload] => [end-push-payload]
phase no difference [-7ms to 0ms]
☑️ Phase [end-push-payload] => [Test End]
phase no difference [-1ms to 0ms]

Scenario - update-with-same-state: ✅ Performance improved

✅ duration
phase estimated improvement -15ms [-22ms to -8ms] OR -1.37% [-1.98% to -0.75%]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 0ms]
☑️ Phase [start-data-generation] => [start-push-initial-payload]
phase no difference [0ms to 1ms]
☑️ Phase [start-push-initial-payload] => [start-peek-records]
phase no difference [-3ms to 0ms]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
✅ Phase [start-record-materialization] => [start-relationship-materialization]
phase estimated improvement -17ms [-19ms to -10ms] OR -24.03% [-27.67% to -14.11%]
⚠️ Phase [start-relationship-materialization] => [start-local-removal]
phase estimated regression +7ms [2ms to 12ms] OR +2.16% [0.78% to 3.64%]
⚠️ Phase [start-local-removal] => [start-push-minus-one-payload]
phase estimated regression +2ms [1ms to 3ms] OR +0.7% [0.22% to 1.12%]
☑️ Phase [start-push-minus-one-payload] => [start-local-addition]
phase no difference [0ms to 0ms]
✅ Phase [start-local-addition] => [start-push-plus-one-payload]
phase estimated improvement -3ms [-4ms to -2ms] OR -7.36% [-9.27% to -5.43%]
☑️ Phase [start-push-plus-one-payload] => [end-push-plus-one-payload]
phase no difference [-2ms to 1ms]
✅ Phase [end-push-plus-one-payload] => [Test End]
phase estimated improvement -4ms [-5ms to -3ms] OR -13.05% [-15.51% to -8.79%]

Scenario - update-with-same-state-m2m: ☑️ Performance is stable

☑️ duration
phase no difference [0ms to 7ms]
☑️ Phase [navigationStart] => [start-data-generation]
phase no difference [-1ms to 0ms]
⚠️ Phase [start-data-generation] => [start-push-initial-payload]
phase estimated regression +1ms [0ms to 1ms] OR +0.31% [0.01% to 0.63%]
☑️ Phase [start-push-initial-payload] => [start-peek-records]
phase no difference [-1ms to 2ms]
☑️ Phase [start-peek-records] => [start-record-materialization]
phase no difference [0ms to 0ms]
☑️ Phase [start-record-materialization] => [start-relationship-materialization]
phase no difference [0ms to 0ms]
☑️ Phase [start-relationship-materialization] => [start-local-removal]
phase no difference [-1ms to 0ms]
⚠️ Phase [start-local-removal] => [start-push-minus-one-payload]
phase estimated regression +2ms [1ms to 3ms] OR +1.54% [0.79% to 2.3%]
☑️ Phase [start-push-minus-one-payload] => [start-local-addition]
phase no difference [-1ms to 1ms]
☑️ Phase [start-local-addition] => [start-push-plus-one-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [start-push-plus-one-payload] => [end-push-plus-one-payload]
phase no difference [-1ms to 1ms]
☑️ Phase [end-push-plus-one-payload] => [Test End]
phase no difference [0ms to 0ms]

@runspired runspired merged commit f9b9fe2 into main Mar 12, 2025
28 of 30 checks passed
@runspired runspired deleted the iterable-metrics branch March 12, 2025 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-perf Activates Performance Checks in CI 🎯 canary PR is targeting canary (default) 🏷️ chore This PR primarily refactors code or updates dependencies
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

1 participant