Skip to content

perf: avoid quadratic accumulator rebuilds in item params - #314

Merged
daniil-filippov-dev merged 1 commit into
gravity-ui:mainfrom
chrstnv:perf-quadratic-item-params
Aug 12, 2026
Merged

perf: avoid quadratic accumulator rebuilds in item params#314
daniil-filippov-dev merged 1 commit into
gravity-ui:mainfrom
chrstnv:perf-quadratic-item-params

Conversation

@chrstnv

@chrstnv chrstnv commented Aug 11, 2026

Copy link
Copy Markdown
Contributor
  • getMapItemsIgnores, getItemsParams and getItemsStateAndParams rebuilt their accumulator on every item ({...acc, [id]: value}), which is O(n²) in the number of items
  • on a dashboard with 19k items getMapItemsIgnores alone took ~72s, after the change ~8ms

getMapItemsIgnores, getItemsParams and getItemsStateAndParams rebuilt their
accumulator on every item ({...acc, [id]: value}), making them O(n^2) in the
number of items.

On a dashboard with 19k items getMapItemsIgnores alone took ~72s; after the
change ~8ms. Behaviour is unchanged - the accumulator was a local object in
every case.
@gravity-ui-bot

Copy link
Copy Markdown
Contributor

Preview is ready.

@daniil-filippov-dev
daniil-filippov-dev added this pull request to the merge queue Aug 12, 2026
Merged via the queue into gravity-ui:main with commit 39305d6 Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants