We call it for every encoding and decoding operation currently. We only need to invoke it once per validator set size change.
We should either (a) store the resulting ::reed_solomon::galois_16::ReedSolomon type with the validator set, or else (b) memoize it behind a lazy static (CodeParams,Arc<ReedSolomon>), meaning make_encoder clones and return the the Arc if CodeParams stayed the same or replace it otherwise.
erasure_coding::Params::make_encoder
should be rather slow, due to building the whole Vandermonde matrix.We call it for every encoding and decoding operation currently. We only need to invoke it once per validator set size change.
We should either (a) store the resulting
::reed_solomon::galois_16::ReedSolomon
type with the validator set, or else (b) memoize it behind a lazy static(CodeParams,Arc<ReedSolomon>)
, meaningmake_encoder
clones and return the the Arc ifCodeParams
stayed the same or replace it otherwise.