Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

WIP: try caching component variables in theme#1982

Closed
jurokapsiar wants to merge 1 commit intoperf/custom-toolbar-perffrom
perf/cache-variables
Closed

WIP: try caching component variables in theme#1982
jurokapsiar wants to merge 1 commit intoperf/custom-toolbar-perffrom
perf/cache-variables

Conversation

@jurokapsiar
Copy link
Contributor

@jurokapsiar jurokapsiar commented Sep 30, 2019

Looks like a lot of time is spent just by evaluating variables in each render. Can we instead cache the resolved component variables in the theme, only evaluate props.variables during render and deep merge them?

Example Avg Avg diff Avg Normalized Avg Normalized diff Median Median diff Median Normalized Median Normalized diff
CustomToolbar.perf.tsx (before) 98.09 98.09 41.45 41.45 98.02 98.02 41.31 41.31
CustomToolbar.perf.tsx (after) 71.35 71.35 29.92 29.92 69.98 69.98 30.13 30.13

const originalSource = partStyle

partStylesPrepared[partName] = styleParam => {
return _.merge(callable(originalTarget)(styleParam), callable(originalSource)(styleParam))
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 is causing some merging of styles with null, creating unnecessary instances. the perf improvement on the custom toolbar was around 5%

@miroslavstastny
Copy link
Member

done in #2041

@miroslavstastny miroslavstastny deleted the perf/cache-variables branch October 18, 2019 13:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants