-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Make BitSet store any Int #25029
Make BitSet store any Int #25029
Commits on Dec 19, 2017
-
BitSet: swap the underlying BitVector for Vector{UInt64}
The BitVector had already started to show its limits for BitSet needs. Juggling at 3 layers with BitSet, BitVector, and Vector{UInt64} was becoming confusing at times. Updating this code to handle negative integers only increased the confusion. Some modest performance improvements (~20%) could be achieved in the process for some functions.
Configuration menu - View commit details
-
Copy full SHA for d5d12ad - Browse repository at this point
Copy the full SHA d5d12adView commit details -
morph BitSet into a real Int Set
Add an offset field to BitSet acting as an infimum of stored values, which can be adjusted on-the-fly. BitSet then becomes able to store negative integers, and doesn't have to have elements centered around 0.
Configuration menu - View commit details
-
Copy full SHA for cb49741 - Browse repository at this point
Copy the full SHA cb49741View commit details -
BitSet: use 0-based bit-indexing
The 1-based indexing was forcing to promote Int to Int128 in chk_indice & chk_offset, to allow correct computation with extreme values (e.g. BitSet([typemin(Int)])). 1-based indexing was a left-over from the former BitVector as underlying implementation. Switching to 0-based indexing allows both a more-direct mapping between the model and the implementation, and better performance.
Configuration menu - View commit details
-
Copy full SHA for ed692cd - Browse repository at this point
Copy the full SHA ed692cdView commit details -
BitSet push! & pop! : don't check for emptyness every time
When a BitSet is empty, its offset must be initialized. But checking for emptyness in each invocation of _setint! was costly, so we put the check in a branch which is called less often.
Configuration menu - View commit details
-
Copy full SHA for 13cdaeb - Browse repository at this point
Copy the full SHA 13cdaebView commit details -
optimize updating a value in BitSet
_setint! was delegating to the bitarray code, but then some work was being redone in get_chunks_id. So we split this functionality into lower level functions.
Configuration menu - View commit details
-
Copy full SHA for 7f44009 - Browse repository at this point
Copy the full SHA 7f44009View commit details -
Configuration menu - View commit details
-
Copy full SHA for dd6a94a - Browse repository at this point
Copy the full SHA dd6a94aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 55968e7 - Browse repository at this point
Copy the full SHA 55968e7View commit details -
BitSet: add a couple small optimizations
* isempty: using _check0 instead of all makes it 35% faster * ==: checking first non-overlapping parts is more likely to be faster, as the the lower and upper parts of the bits field are unlikely to be zero (at least for a freshly created BitSet)
Configuration menu - View commit details
-
Copy full SHA for a4371b2 - Browse repository at this point
Copy the full SHA a4371b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 55852ee - Browse repository at this point
Copy the full SHA 55852eeView commit details