Skip to content

switch to ReconstructData

Luke Champine requested to merge rsc-data into master

In July, a PR added a ReconstructData method reedsolomon package. This method only recovers the data pieces, whereas Reconstruct recovers both data and parity pieces. Since we only care about the actual data, ReconstructData is the clear choice, since it is faster.

Benchmarks (recovering a 50-of-200 erasure code with every other piece missing):

with Reconstruct:
BenchmarkRSRecover-4      1000	   2033555 ns/op   515.64 MB/s

with ReconstructData:
BenchmarkRSRecover-4      2000	    692716 ns/op   1513.72 MB/s

NOTE: this does (indirectly) impact repairing. Currently, we repair by downloading pieces, recovering the original data via Recover, and then re-encoding to get the full set of data+parity pieces. We could optimize this by calling Reconstruct on the downloaded pieces directly. Obviously, ReconstructData would not be appropriate here, since we need to recover the parity pieces as well. So we just need to be aware of that if/when we switch to calling Reconstruct directly.

Merge request reports