Skip to content
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

Cache sharedEvents prop to prevent re-renders #1592

Merged
merged 1 commit into from
May 29, 2020
Merged

Conversation

NgoKnows
Copy link
Member

@NgoKnows NgoKnows commented May 28, 2020

This PR implements caching the sharedEvents prop created by victory-shared-events to prevent re-renders, which improves the performance of Victory container components.

TL;DR
VictoryCursorContainer - significant performance increase
VictorySelectionContainer - significant performance increase
VictoryBrushContainer - significant performance increase in uncontrolled cases (ie doesn't re-render on each mousemove)
VictoryVoronoiContainer - small - medium performance increase, with more sparsely positioned data getting more of a performance increase
VictoryZoomContainer - should have a small increase due to not re-rendering axes in uncontrolled cases

Before and After

  • GIFs are after changes
  • Measurements were made in production mode

Cursor Container

Example 1 (1500 points) - 56% decrease in scripting

Kapture 2020-05-28 at 15 05 06

Before

cursor-1

After

cursor-1-after

Example 2 (1500 bars) - 12% decrease in scripting + no dropped frames

Kapture 2020-05-28 at 15 06 01

Before

cursor-2

After

cursor-2-after

Example 3 (10 points) - neglible increase in scripting

Kapture 2020-05-28 at 15 11 05

Before

cursor-3

After

cursor-3-after

Selection Container

Example 1 (400 points) - 39% decrease in scripting

Kapture 2020-05-28 at 15 14 23

Before

selection-1

After

selection-1-after

Example 2 (50 points) - 42% decrease in scripting

Kapture 2020-05-28 at 15 12 29

Before

selection-2

After

selection-2-after

Example 3 - 48% decrease in scripting

Kapture 2020-05-28 at 15 15 16

Before

selection-3

After

selection-3-after

Voronoi Container

Example 1 - negilible increase

voronoi-small

Before

voronoi-1

After

voronoi-1-after

Example 2 - about the same

Kapture 2020-05-28 at 15 01 06

Before

voronoi-2

After

voronoi-2-after

Example 3 - 9% decrease in scripting

Kapture 2020-05-28 at 15 04 06

Before

voronoi-3

After

voronoi-3-after

Brush Container

Example 1 - 46% decrease in scripting

Kapture 2020-05-28 at 15 12 29

Before

brush-1

After

brush-1-after

@NgoKnows NgoKnows marked this pull request as draft May 28, 2020 21:25
@NgoKnows NgoKnows requested a review from boygirl May 29, 2020 21:49
@NgoKnows NgoKnows marked this pull request as ready for review May 29, 2020 21:49
Copy link
Contributor

@boygirl boygirl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NgoKnows Thanks for this improvement and the excellent write up! Approved!

@NgoKnows NgoKnows merged commit c9b9d18 into master May 29, 2020
@NgoKnows NgoKnows deleted the cache-shared-events branch May 29, 2020 22:15
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.

2 participants