bitarray icon indicating copy to clipboard operation
bitarray copied to clipboard

Dump load

Open yegct opened this issue 3 years ago • 2 comments

What

This PR allows BitArray to be dumped to disk and subsequently loaded from disk. It also adds the ability to union two bitarrays. And there's a new class, BitArrayFile, allowing for read-only access to a dumped BitArray, providing a means to query the array without having to load it in to RAM.

Tests

$ ruby test/test_bit_array.rb 
Run options: --seed 52069

# Running:

.................

Finished in 0.007989s, 2127.8684 runs/s, 527461.0175 assertions/s.

17 runs, 4214 assertions, 0 failures, 0 errors, 0 skips


$ ruby test/test_bit_array_file.rb 
Run options: --seed 36015

# Running:

....

Finished in 0.003689s, 1084.2876 runs/s, 37950.0675 assertions/s.

4 runs, 140 assertions, 0 failures, 0 errors, 0 skips

Additionally, I tested this with a bitarray consisting of a little over 2 billion bits. I was able to dump, load, and use BitArrayFile to query the bits.

yegct avatar Apr 13 '22 20:04 yegct

I've merged the previous one but this will take a little bit more review - thanks for now though!

peterc avatar May 03 '22 13:05 peterc

I've merged the previous one but this will take a little bit more review - thanks for now though!

Rebased off of main. If you don't like/want the union, let me know and I'll drop that (and associated tests). If you want me to do some cleanup, happy to do that too.

yegct avatar May 03 '22 20:05 yegct