/BitTracker

Bit wise, memory efficient tracker.

Primary LanguageC++MIT LicenseMIT

BitTracker

Bit wise, memory efficient tracker.

Pack your indivdual bits as tightly as possible in a byte array, abstracted by the IBitTracker interface, and constructed using the templated class BitTracker.

Bit Tracker Example

Bit Tracker 8

Clear all: [0 0 0 0 0 0 0 0]

Set all: [1 1 1 1 1 1 1 0]

Reading 7 bits took 6 us per bit.

Writing 7 bits took 5 us per bit.

Linear clear walk...

1 bytes for: 7 bits.

[1 1 1 1 1 1 1 0]

[0 1 1 1 1 1 1 0]

[0 0 1 1 1 1 1 0]

[0 0 0 1 1 1 1 0]

[0 0 0 0 1 1 1 0]

[0 0 0 0 0 1 1 0]

[0 0 0 0 0 0 1 0]

[0 0 0 0 0 0 0 0]

... done.

Bit Tracker Template 16 Clear all: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

Set all: [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]

Reading 16 bits took 6 us per bit.

Writing 16 bits took 6 us per bit.

Linear clear walk...

2 bytes for: 16 bits.

[1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]

[0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]

[0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1]

[0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1]

[0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1]

[0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1]

[0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1]

[0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1]

[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1]

[0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1]

[0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1]

[0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1]

[0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1]

[0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1]

[0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1]

[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1]

[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]

... done.

Bit Tracker Template 30

Clear all: [_ _ _ _]

Set all: [# # # #]

Reading 30 bits took 6 us per bit.

Writing 30 bits took 6 us per bit.

Linear clear walk...

4 bytes for: 30 bits.

[# # # #]

[_ # # #]

[_ _ # #]

[_ _ _ #]

[_ _ _ _]

... done.

Bit Tracker Template 63

Clear all: [_ _ _ _ _ _ _ _]

Set all: [# # # # # # # #]

Reading 63 bits took 5 us per bit.

Writing 63 bits took 6 us per bit.

Linear clear walk...

8 bytes for: 63 bits.

[# # # # # # # #]

[_ # # # # # # #]

[_ _ # # # # # #]

[_ _ _ # # # # #]

[_ _ _ _ # # # #]

[_ _ _ _ _ # # #]

[_ _ _ _ _ _ # #]

[_ _ _ _ _ _ _ #]

[_ _ _ _ _ _ _ _]

... done.

Bit Tracker Template 257

Clear all: [_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _]

Set all: [# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

Reading 257 bits took 5 us per bit.

Writing 257 bits took 6 us per bit.

Linear clear walk...

33 bytes for: 257 bits.

[# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ # #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #]

[_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _]

... done.

Bit Tracker Test Complete