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

refactor: use sets instead of lists for stashing circular references (DEV-2771) #548

Conversation

BalduinLandolt
Copy link
Collaborator

No description provided.

@linear
Copy link

linear bot commented Oct 5, 2023

@BalduinLandolt BalduinLandolt self-assigned this Oct 5, 2023
@BalduinLandolt BalduinLandolt marked this pull request as ready for review October 5, 2023 10:55
Co-authored-by: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com>
Copy link
Collaborator

@jnussbaum jnussbaum left a comment

Choose a reason for hiding this comment

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

I didn't look closely at the algorithm, I just trust you :-)

@BalduinLandolt
Copy link
Collaborator Author

I didn't look closely at the algorithm, I just trust you :-)

sounds risky! xD

Copy link
Collaborator

@Nora-Olivia-Ammann Nora-Olivia-Ammann left a comment

Choose a reason for hiding this comment

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

Looks good to me.
What is the advantage to switch to sets in this case?

@BalduinLandolt
Copy link
Collaborator Author

Looks good to me. What is the advantage to switch to sets in this case?

In this case an insignificant performance increase (if x in y: ... is considerably faster with sets, and that happens a lot here; but this is not the slow part of the code, so it doesn't matter.)
But mostly I can do isSubsetOf() which does away with having to check for each link, if it is in the ok set. This could be done with all(...) too, but less nicely. And this allowed me to get rid of the ok boolean which made the whole loop ugly and caused an extra step of if-nesting.

But this was mostly about getting a PR merged to warm up with the repo; and only marginally to make it easier to change stuff in a later step.

@BalduinLandolt BalduinLandolt enabled auto-merge (squash) October 5, 2023 11:39
@BalduinLandolt BalduinLandolt merged commit 68605bd into main Oct 5, 2023
4 checks passed
@BalduinLandolt BalduinLandolt deleted the feature/dev-2771-use-sets-instead-of-lists-for-stashing-circular-references branch October 5, 2023 11:47
@daschbot daschbot mentioned this pull request Oct 5, 2023
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.

None yet

3 participants