-
Notifications
You must be signed in to change notification settings - Fork 49
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
[PERF] import/export XLSX #5660
base: master
Are you sure you want to change the base?
Conversation
58367c8
to
05efb53
Compare
5ace8db
to
27c595e
Compare
During data import/export snapshotting, getItemId is heavily used, and its reliance on deepEquals for item comparisons can be very time-consuming with large datasets. This commit replaces the deepEquals call with a cache lookup, using pre-populated stringified representations of the items. This optimization reduces the processing time during snapshotting. Tests on our largest datasets show a 30% improvement in overall import performance. Task: 4563258
Only declare the result array when necessary. Optimize element traversal based on type (array or object). Tests on our largest datasets show a 3% improvement in overall import performance. Task: 4563258
27c595e
to
a54d0e9
Compare
…or loop in addRows Previously, heavy PositionMap constants were declared within the for loop, leading to unnecessary overhead on each iteration. This change moves their declaration outside the loop to optimize performance. Task: 4563258
During data export, `pushElement` is heavily used, and its reliance on deepEquals for property comparisons can be very time-consuming with large datasets. This commit replaces the deepEquals call with a cache lookup, using pre-populated stringified representations of the properties. This optimization reduces the processing time during export. For these last two commits, testing on our largest datasets shows a 90% improvement in overall export perfomance. Task: 4563258
a54d0e9
to
61d1524
Compare
result += getCanonicalRepresentation(item[i]); | ||
} | ||
return result + "]"; | ||
} |
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.
Maybe we can do something like item.map(getCanonicalRepresentation).join(',')
, but I'm not sure about the performance
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.
(as you want)
src/helpers/data_normalization.ts
Outdated
@@ -45,3 +59,29 @@ export function* iterateItemIdsPositions(sheetId: UID, itemIdsByZones: Record<st | |||
} | |||
} | |||
} | |||
|
|||
function getCanonicalRepresentation(item: any): string { |
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.
Maybe we can use number as the canonical representation of number and have number | string as the reverseLookup map key :)
Task: 4563258