bitvec: Unboxed bit vectors

[ bit-vectors, bsd3, data, library, public-domain ] [ Propose Tags ]

Bit vectors library for Haskell.

The current vector package represents unboxed arrays of Bool allocating one byte per boolean, which might be considered wasteful. This library provides a newtype wrapper Data.Bit.Bit and a custom instance of unboxed Data.Vector.Unboxed.Vector, which packs booleans densely. It is a time-memory tradeoff: 8x less memory footprint at the price of moderate performance penalty (mostly, for random writes).

Thread safety

  • Data.Bit is faster, but thread-unsafe. This is because naive updates are not atomic operations: read the whole word from memory, modify a bit, write the whole word back.

  • Data.Bit.ThreadSafe is slower (up to 2x), but thread-safe.

Similar packages

  • bv and bv-little offer only immutable size-polymorphic bit vectors. bitvec provides an interface to mutable vectors as well.

  • array is memory-efficient for Bool, but lacks a handy Vector interface and is not thread-safe.

Flags

Automatic Flags
NameDescriptionDefault
bmi2

Enable bmi2 instruction set

Disabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

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

Package maintainers

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.8 && <5), bits-extra (>=0.0.0.4 && <0.1), ghc-prim, primitive (>=0.5), semigroups (>=0.8), vector (>=0.11 && <0.13) [details]
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:42:45Z
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 2019-07-27T16:26:54Z
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 15 direct, 4903 indirect [details]
Downloads 14011 total (377 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 2019-07-27 [all 1 reports]