Removed bitvec dependency, wrote a quick BitWriter struct that allows pushing 11 bits onto a Vec<u8> at once.
Removed a bunch of unnecessary allocations. This results in some (not all) functions that used to take generic S: Into<String> to take &str, which is more idiomatic although it is a breaking change on the API surface. Functions that need allocated strings (constructors that return owned structs mostly) remained unaffected.
wordlist and wordmap work using &'static str instead of Strings to avoid unnecessary allocations (not very critical).
Replaced Result<T, Error> with custom Result<T> from error_chain.
Bunch of smaller idiomatic changes that I likely can't recall here.
Added benchmarks (rustup run nightly cargo bench). Phrase validation time has been cut to nearly a quarter of original time.
bitvec
dependency, wrote a quickBitWriter
struct that allows pushing 11 bits onto aVec<u8>
at once.S: Into<String>
to take&str
, which is more idiomatic although it is a breaking change on the API surface. Functions that need allocated strings (constructors that return owned structs mostly) remained unaffected.wordlist
andwordmap
work using&'static str
instead ofString
s to avoid unnecessary allocations (not very critical).Result<T, Error>
with customResult<T>
fromerror_chain
.rustup run nightly cargo bench
). Phrase validation time has been cut to nearly a quarter of original time.