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

Make BitSet store any Int #25029

Merged
merged 9 commits into from
Dec 19, 2017
Merged

Make BitSet store any Int #25029

merged 9 commits into from
Dec 19, 2017

Commits on Dec 19, 2017

  1. 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.
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    d5d12ad View commit details
    Browse the repository at this point in the history
  2. 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.
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    cb49741 View commit details
    Browse the repository at this point in the history
  3. 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.
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    ed692cd View commit details
    Browse the repository at this point in the history
  4. 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.
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    13cdaeb View commit details
    Browse the repository at this point in the history
  5. 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.
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    7f44009 View commit details
    Browse the repository at this point in the history
  6. re-implement rand(::BitSet)

    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    dd6a94a View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    55968e7 View commit details
    Browse the repository at this point in the history
  8. 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)
    rfourquet committed Dec 19, 2017
    Configuration menu
    Copy the full SHA
    a4371b2 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    55852ee View commit details
    Browse the repository at this point in the history