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

Avoid expensive collection calls #24770

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

wendigo
Copy link
Contributor

@wendigo wendigo commented Jan 22, 2025

Description

Additional context and related issues

Release notes

( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

## Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Jan 22, 2025
@wendigo wendigo requested a review from losipiuk January 22, 2025 17:29
@wendigo wendigo force-pushed the serafin/avoid-contains-all branch from 413ec91 to a17efc1 Compare January 22, 2025 17:39
@wendigo wendigo changed the title Serafin/avoid contains all Avoid expensive collection calls Jan 22, 2025
Copy link
Member

@losipiuk losipiuk left a comment

Choose a reason for hiding this comment

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

I am not convinced. How big collections are we talking about here?
10*10 is not much

@wendigo
Copy link
Contributor Author

wendigo commented Jan 22, 2025

@losipiuk it depends on how wide the table is, right?


public static boolean containsNone(Collection<Symbol> values, Collection<Symbol> testValues)
{
return values.stream().noneMatch(ImmutableSet.copyOf(testValues)::contains);
Copy link
Member

Choose a reason for hiding this comment

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

why iterate this one and not the other

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 method was just moved to a single utility class. It didn't change over the original one :)

@losipiuk
Copy link
Member

losipiuk commented Jan 23, 2025

@losipiuk it depends on how wide the table is, right?

Yep - but if you look at how this is used we iterate over hashSymbol, or groupingSymbols; and in non-pathological case there should not be many of those.
I just do not think it matters much so why make code less readable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants