Skip to content

Packing heap bits #821

@eliassjogreen

Description

@eliassjogreen

An easy memory win, and hopefully in turn performance win would be to move all of the Box<[bool]>s to use some kind of packed representation which should hopefully save ~>8x the memory (With a full "default" heap capacity of 18304 bytes we would shrink it to a mere 2288 bytes).

Doing a quick bit of searching I could find a few appropriate rust crates for creating and using bit-vectors:

  • https://github.com/PsiACE/bitsvec

    • SIMD accelerated
    • Sadly #![feature(portable_simd)] which it uses isn't available on stable rust channel
    • Fastest according to own benchmarks
    • Uses SmallVec, might be bad for our use case because we can probably expect to almost always exceed the limit of SmallVec
    • No trait Iterator support :(
  • https://github.com/ferrilab/bitvec

    • Most popular, 1.3k gh stars, 100k+ uses
  • Roll our own

    • Full control, can optimize for our specific use-case. Yet another of our specialized small_* types
    • More work, reinventing the wheel or just extra fun?
    • SIMD?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions