Uh oh!
There was an error while loading. Please reload this page.
Speedup create_list_without_duplicates function - #795
Conversation
The current implementation includes a relatively expensive operation to check if an element is in a list. This commmit introduces a set operation that is constant time. Signed-off-by: John Speed Meyers <jsmeyers@chainguard.dev>
jspeed-meyers
commented
Feb 4, 2024
It looks like there is a failure of The tests passed locally on my machine: macOS Version 14.2.1 with Python 3.11.7 -- Are the tests in the CI and the local tests different in some way? I apologize. I wouldn't have submitted this PR if I knew my local tests weren't a good representation of the CI tests. Any ideas? |
| for element in list_with_potential_duplicates: | ||
| if element not in list_without_duplicates: | ||
| if element not in seen_elements: | ||
| seen_elements.add(element) |
There was a problem hiding this comment.
Instead of storing the element, you could store the element ID or similar to #792 store the astuple(element). This could solve the current issues in the CI
There was a problem hiding this comment.
Cool! I'll look into this soon.
jspeed-meyers
commented
Mar 13, 2024
On second thought: I'm not sure this change is worth it. Sorry for the noise! |
Fix#794.