Module guff::good [−][src]
Expand description
A set of “good” optimised routines in native Rust
This module provides a set of alternative implementations of GaloisField that are faster than the reference implementation. This is provided for those who are interested in having a reasonable set of fairly fast routines, but who don’t particularly care about how they’re implemented.
This module is intended to provide a reasonable balance between:
- speed;
- memory footprint;
- range of field sizes; and
- supported polynomials
The actual implementation used here may change over time. In fact,
some of the fields may even default to using the reference
implementation for some calculations. It can be assumed, however,
that at least the mul
routines implemented by objects here will
be faster than the corresponding reference implementation, since
this is usually the method that will be called most often in an
application.
SemVer implications
Once I have added a constructor here, it will continue to be available across all minor versions of the library. In other words, in terms of semantic versioning, removing a constructor here counts as breaking the application interface.
However, no guarantees are made as to how the optimised version
works internally. In particular, no guarantee of speed is made.
Nor should the contents of the struct
implementing the method be
considered part of the application interface. That can change at
any time.
Benchmarking
I’ve implemented some basic benchmarks using Criterion
. After
downloading the source for this project, simply run:
cargo bench
Tests marked ref
are run using the default, reference
implementations, while those marked with good
are for fields
constructed using the functions below.
Functions
Optimised GF(24) with the (primitive) polynomial 0x13
Optimised GF(28) with the (non-primitive) polynomial 0x11b
Optimised GF(216) with the (primitive?) polynomial 0x1002b