Duplicate branch list to avoid skipping entries#768
Conversation
|
not to nitpick, but would |
This loop is change the list of branches while it's iterating over it. I can't explain why this hasn't been blowing up builds for the past decade, but on Python 3.14, this can result in skipping entries in the list when other entries are removed.
adadcf0 to
962aac6
Compare
It may convey intention better, yeah. That said I think it's a pretty standard practice. Looks like that was introduced in Python 3.3, which is relatively recent against the lifetime of Bloom, but we're only supporting back to Python 3.6 right now so it would be okay. Not that duplicating our list of <20 strings would actually be a performance concern, but I did some light benchmarking and constructing a new (mutable) list using |
tfoote
left a comment
There was a problem hiding this comment.
The copy indicator is definitely easier to read/maintain which is best for this use case.
Interesting that the tuple constructor is that much faster.
christophebedard
left a comment
There was a problem hiding this comment.
Not that duplicating our list of <20 strings would actually be a performance concern, but I did some light benchmarking and constructing a new (mutable) list using list.copy() was roughly 18% slower than creating a new (immutable) tuple (for a list of 6 strings). Pretty irrelevant here, but good to know.
Interesting!
This loop is changing the list of branches while it's iterating over it. I can't explain why this hasn't been blowing up builds for the past decade, but at least on Python 3.14, this can result in skipping entries in the list when other entries are removed.