[FW][IMP] history: reduce memory allocation #3187
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport of d8d943b
addChange
is used a lot, like a lot, a lot, for every mutation in core plugins. Its performance is key.Currently
const [root, ...path] = args
creates a new array forpath
, the array is allocated, and must be garbage collected later.On the large formula dataset, with 20k rows (520k cells), and adding a column before A, then reload the spreadsheet:
(average over 5 runs)
before 1609ms 1168ms
after 1094ms 753ms
-32% -35%
The memory usage also decreases: right after loading, memory was ~1725Mb and ~792Mb after running the GC. It's now ~1455Mb right after loading and ~670Mb after running the GC. (I'm not sure why it goes from 792Mb to 670Mb. Is it just thanks to the removed "root" key)
Description:
description of this task, what is implemented and why it is implemented that way.
Task: : TASK_ID
review checklist
Forward-Port-Of: #3170