Julia struct-s packed at bit boundaries into a primitive 64 bit type.
BitStructs has the following use cases in mind:
-
memory reduction for tables with fields having very few instances like flags, status info, enumerations. A couple of columns in such tables could be combined into a Vector{T<:BitStruct}
-
pooling of several method parameters in one BitStruct instance. This reduces push/pop overhead in method execution for methods which are not inlined, and can improve runtime performance, because the compiler gets more choices for keeping data in CPU registers.
-
reading and writing of bitpacked binary data
As soon as I think the package is usable, it will become a registered julia package.
see test/tutorial.jl for an introduction
see test/benchmarks.jl for some timing comparisons
With julia 1.6-RC1, reading fields is nearly as fast as reading fields in standard julia struct-s. Older julia releases do not perform full constant propagation on field read access ==> 100-1000 times slower.
Setting fields is currently under investigation.