bitvec: Space-efficient bit vectors
A newtype over Bool
with a better Vector
instance: 8x less memory, up to 1000x faster.
The vector
package represents unboxed arrays of Bool
spending 1 byte (8 bits) per boolean.
This library provides a newtype wrapper Bit
and a custom instance
of unboxed Vector
, which packs bits densely,
achieving 8x less memory footprint.
The performance stays mostly the same;
the most significant degradation happens for random writes
(up to 10% slower).
On the other hand, for certain bulk bit operations
Vector
Bit
is up to 1000x faster than Vector
Bool
.
Thread safety
Data.Bit is faster, but writes and flips are thread-unsafe. This is because naive updates are not atomic: read the whole word from memory, then modify a bit, then write the whole word back.
Data.Bit.ThreadSafe is slower (up to 20%), but writes and flips are thread-safe.
Similar packages
array is memory-efficient for
Bool
, but lacks a handyVector
interface and is not thread-safe.
[Skip to Readme]
Flags
Automatic Flags
Name | Description | Default |
---|---|---|
integer-gmp | Use integer-gmp package for binary polynomials | Enabled |
libgmp | Link against GMP library | Enabled |
Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info
Downloads
- bitvec-1.0.3.0.tar.gz [browse] (Cabal source package)
- Package description (revised from the package)
Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
Versions [RSS] | 0.1, 0.1.0.1, 0.1.0.2, 0.1.1.0, 0.2.0.0, 0.2.0.1, 1.0.0.0, 1.0.0.1, 1.0.1.0, 1.0.1.1, 1.0.1.2, 1.0.2.0, 1.0.3.0, 1.1.0.0, 1.1.1.0, 1.1.2.0, 1.1.3.0, 1.1.4.0, 1.1.5.0 (info) |
---|---|
Change log | changelog.md |
Dependencies | base (>=4.9 && <5), deepseq, ghc-prim, integer-gmp, primitive (>=0.5), semigroups (>=0.8), vector (>=0.11 && <0.13) [details] |
Tested with | ghc ==8.0.2, ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.1, ghc ==8.8.2, ghc ==8.8.3, ghc ==8.10.1 |
License | BSD-3-Clause |
Copyright | 2019 Andrew Lelechenko, 2012-2016 James Cook |
Author | Andrew Lelechenko <andrew.lelechenko@gmail.com>, James Cook <mokus@deepbondi.net> |
Maintainer | Andrew Lelechenko <andrew.lelechenko@gmail.com> |
Revised | Revision 1 made by Bodigrim at 2022-06-19T20:41:40Z |
Category | Data, Bit Vectors |
Home page | https://github.com/Bodigrim/bitvec |
Source repo | head: git clone git://github.com/Bodigrim/bitvec.git |
Uploaded | by Bodigrim at 2020-03-25T22:22:22Z |
Distributions | Arch:1.1.3.0, Fedora:1.1.4.0, LTSHaskell:1.1.5.0, NixOS:1.1.5.0, Stackage:1.1.5.0, openSUSE:1.1.5.0 |
Reverse Dependencies | 16 direct, 5012 indirect [details] |
Downloads | 16296 total (406 in the last 30 days) |
Rating | 2.25 (votes: 2) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2020-03-25 [all 1 reports] |