Closed scott-griffiths closed 2 years ago
s = bitstring.BitArray(100000000) s.set(1, [4, 44, 4444444])
s.count(1) takes about 4 seconds whereas
s.count(1)
len(list(s.findall('0b1')))
is at least 10x faster. Count should be at least as fast as find!
This might be an edge case for very sparse bitstrings. If I count zeros instead then the count time stays the same but the find time is horrendous!
count
find
s.count(1)
takes about 4 seconds whereaslen(list(s.findall('0b1')))
is at least 10x faster. Count should be at least as fast as find!