Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

replace lodash omit #577

Merged
merged 4 commits into from Apr 4, 2018
Merged

replace lodash omit #577

merged 4 commits into from Apr 4, 2018

Conversation

chrisbolin
Copy link
Contributor

@chrisbolin chrisbolin commented Apr 3, 2018

Changes

Preliminary Results

@tptee reported that _.omit in getDataStyles was a bottleneck for an application he was working on. Here are the testing results on a modified version of victory-brush-container-demo.js with 800 points, VictoryScatter (rather than VictoryLine, as scatter calls getDataStyles on every point), VictoryBrushContainer, and VictoryZoomContainer:

  • getDataStyles self-time improved by 4.7x (i.e. it now only takes about a fifth of the time to execute)
  • framerate increased a bit, by 5%-10%

Again, this was just a quick test I threw together; not the application that had actually ID'd getDataStyles and omit as bottlenecks.

Open Questions

  • Do we want to move the babel config change to the builder-victory-component archetype?
  • Do we want to wait for more compelling tests before merging? I don't want to push us to change something out of momentum. On the other hand, this change also allows for easier for a future lodash 5 upgrade (which will drop omit), removes a function that many other projects have had trouble with, establishes named exports from victory-core into victory-chart.

Notes

Because victory-core's omit change has been merged by not released (intentionally, just in case work in victory-chart necessitated more changes), all my work was done on lank; tests using the actual victory-core will fail. If we approve these changes, I'll make a victory-core release, update the dependency here, and then ensure everything passes on this PR.

Copy link
Member

@ryan-roemer ryan-roemer left a comment

Choose a reason for hiding this comment

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

LGTM -- however, do we want to take the hit of rolling the babel config + deps + all that back to the archetype now? Might make sense because we'll need that infrastructure in any repo we touch...

@boygirl
Copy link
Contributor

boygirl commented Apr 3, 2018

@chrisbolin I'm definitely in favor of removing lodash omit even if it only gives us moderate performance improvement.

@boygirl
Copy link
Contributor

boygirl commented Apr 3, 2018

I think most of the uses of omit can actually be removed anyway, since we added a whitelist for svg styles: https://github.com/FormidableLabs/victory-core/blob/master/src/victory-util/style.js#L24

@chrisbolin
Copy link
Contributor Author

now that we've done FormidableLabs/victory-core#347, i can revisit this PR and remove the duplicate style-scrubbing

import { VictoryContainer, VictoryTooltip, Helpers, TextSize } from "victory-core";
import { omit } from "victory-core/es/victory-util/helpers";
Copy link
Contributor

Choose a reason for hiding this comment

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

It bugs me that we have just this one use of omit left outside of victory-core. What do you think about refactoring it to use a different method all together?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

love it!

@chrisbolin
Copy link
Contributor Author

@boygirl how about this approach?

@boygirl
Copy link
Contributor

boygirl commented Apr 4, 2018

github doesn't have the emoji I want to express my approval. :the_horns:

@chrisbolin chrisbolin changed the title replace lodash omit with victory-core omit replace lodash omit Apr 4, 2018
@chrisbolin chrisbolin merged commit a83700a into master Apr 4, 2018
@boygirl boygirl deleted the remove-lodash-omit branch April 19, 2018 20:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants