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

[core] fix(OverflowList): improve performance, allow more items #5355

Merged

Conversation

matt-gold
Copy link
Contributor

@matt-gold matt-gold commented Jun 6, 2022

Use binary search instead of sequential search in the OverflowList repartition cycle to increase collapsible elements from 50 to 2^50.

Fixes #3792

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

This pull request changes the algorithm used to repartition the OverflowList so that it can support a much higher number of items. The previous overflow list would break if there were 50 or more items collapsed into the Overflow element as described in issue #3792.

Reviewers should focus on:

The new OverflowList partitioning logic.

…partition cycle to increase collapsible elements from 50 to 2^50.

Fixes palantir#3792
@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @matt-gold! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

@adidahiya adidahiya self-requested a review June 6, 2022 17:47
@adidahiya adidahiya changed the title Use binary search instead of sequential search in the OverflowList re… [core] fix(OverflowList): improve performance, allow more items Jun 16, 2022
Copy link
Contributor

@adidahiya adidahiya left a comment

Choose a reason for hiding this comment

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

docs preview

looks good! no regressions here:
2022-06-16 16 48 06

and thanks for fixing the test suite, nice to see those tests back in action :)

I just have a small code style comment, but otherwise this is pretty much ready to merge :shipit:

Comment on lines +117 to +119
/** Pointer for the binary search algorithm used to find the finished non-overflowing state */
chopSize: number;
lastChopSize: number | null;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think either of these need to live in state, they can just be private members of the component class. They are not referenced in any lifecycle method, just repartition(), so it should be save to move out of state.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a huge deal, though, so I can fix it in a follow-up PR if necessary. Thanks for the contribution @matt-gold!

@adidahiya adidahiya merged commit 55feb05 into palantir:develop Jun 17, 2022
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.

[OverflowList] Implement more efficient logic to avoid triggering React setState depth limit
3 participants