-
-
Notifications
You must be signed in to change notification settings - Fork 97
enhance: Minor peformance optimization #3684
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
Conversation
🦋 Changeset detectedLatest commit: 154c4c3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
Details
| Benchmark suite | Current: 154c4c3 | Previous: ad50b97 | Ratio |
|---|---|---|---|
normalizeLong |
525 ops/sec (±0.90%) |
526 ops/sec (±1.05%) |
1.00 |
denormalizeLong |
291 ops/sec (±2.29%) |
294 ops/sec (±2.20%) |
1.01 |
denormalizeLong donotcache |
936 ops/sec (±2.12%) |
1040 ops/sec (±0.17%) |
1.11 |
denormalizeShort donotcache 500x |
1593 ops/sec (±0.87%) |
1588 ops/sec (±0.45%) |
1.00 |
denormalizeShort 500x |
869 ops/sec (±1.48%) |
868 ops/sec (±1.89%) |
1.00 |
denormalizeShort 500x withCache |
6585 ops/sec (±0.08%) |
6577 ops/sec (±0.24%) |
1.00 |
queryShort 500x withCache |
2750 ops/sec (±0.10%) |
2783 ops/sec (±0.12%) |
1.01 |
buildQueryKey All |
54340 ops/sec (±0.18%) |
55271 ops/sec (±0.32%) |
1.02 |
query All withCache |
8036 ops/sec (±0.20%) |
7952 ops/sec (±0.24%) |
0.99 |
denormalizeLong with mixin Entity |
286 ops/sec (±2.16%) |
276 ops/sec (±2.07%) |
0.97 |
denormalizeLong withCache |
7154 ops/sec (±0.14%) |
7400 ops/sec (±0.26%) |
1.03 |
denormalizeLong All withCache |
8080 ops/sec (±0.18%) |
7711 ops/sec (±0.22%) |
0.95 |
denormalizeLong Query-sorted withCache |
8083 ops/sec (±0.51%) |
7961 ops/sec (±0.16%) |
0.98 |
denormalizeLongAndShort withEntityCacheOnly |
1697 ops/sec (±0.18%) |
1769 ops/sec (±0.39%) |
1.04 |
getResponse |
5603 ops/sec (±1.46%) |
5721 ops/sec (±1.20%) |
1.02 |
getResponse (null) |
7296864 ops/sec (±0.74%) |
7195694 ops/sec (±0.74%) |
0.99 |
getResponse (clear cache) |
276 ops/sec (±2.17%) |
268 ops/sec (±2.29%) |
0.97 |
getSmallResponse |
3076 ops/sec (±0.42%) |
3148 ops/sec (±0.15%) |
1.02 |
getSmallInferredResponse |
2360 ops/sec (±0.13%) |
2242 ops/sec (±0.14%) |
0.95 |
getResponse Collection |
5309 ops/sec (±1.05%) |
5821 ops/sec (±1.08%) |
1.10 |
get Collection |
5509 ops/sec (±0.17%) |
5744 ops/sec (±0.35%) |
1.04 |
get Query-sorted |
6624 ops/sec (±0.21%) |
6610 ops/sec (±0.44%) |
1.00 |
setLong |
549 ops/sec (±0.13%) |
545 ops/sec (±0.19%) |
0.99 |
setLongWithMerge |
250 ops/sec (±0.42%) |
246 ops/sec (±0.20%) |
0.98 |
setLongWithSimpleMerge |
268 ops/sec (±0.17%) |
261 ops/sec (±0.11%) |
0.97 |
setSmallResponse 500x |
949 ops/sec (±0.09%) |
962 ops/sec (±0.10%) |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3684 +/- ##
=======================================
Coverage 98.29% 98.30%
=======================================
Files 148 148
Lines 2582 2589 +7
Branches 501 502 +1
=======================================
+ Hits 2538 2545 +7
Misses 10 10
Partials 34 34 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Motivation
Improve normalization performance, especially for data with many entities or deep nesting.
Solution
.forEach()withforloops in schema normalization/denormalization paths for reduced function call overheadSetinstead of arrays in circular reference detection (getCheckLoop) for O(1) lookups instead of O(n)Map.get()results to avoid redundant lookupsNote
Improves hot-path normalization/denormalization performance.
Object.keys(...).forEachwith indexedforloops inEntityMixin.normalize()andObjectschema helpers to reduce call/iterator overheadgetCheckLoopcircular reference tracking fromobject[]toSet<object>with cachedMap.get()results for O(1) membership checksstart:trace,start:deopt) and updates examples docs@data-client/endpoint,@data-client/normalizr,@data-client/rest,@data-client/graphql,@data-client/react,@data-client/vueWritten by Cursor Bugbot for commit 154c4c3. This will update automatically on new commits. Configure here.