Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Mutate the doc.parts array when printing fill #3273
Context: #3263 (comment)
Slicing the array means copying the array's content for every pair, which makes the algorithm quadratic. This PR changes the copying to mutating the array directly to prevent that. It's a more dangerous approach but the way
I'm not 100% comfortable with that and I'll take suggestions.
This is a bit out of scope, but what if we used something like Immutable.js to allow us to avoid mutation without impacting performance (or with very little impact)? Obviously this would be a larger, separate change, but I wanted to throw it out there.
Nov 16, 2017
@josephfrazier immutable.js has a non trivial performance impact. In a React context, the performance overhead of the immutable data structures on-top of the js ones is offset by the wins you get from shouldComponentUpdate.
In our case, those data structures are pretty performance sensitive, so I'd be willing to be that we'll see a non trivial regression.