The XOR based example is ten times slower than it could because it uses
the buffer::ptr[] operator. Use a temporary char * instead. It performs
as well as jerasure Reed Solomon when decoding with a single erasure:
$ ceph_erasure_code_benchmark \
--plugin example --parameter erasure-code-directory=.libs \
--parameter erasure-code-technique=example \
--parameter erasure-code-k=2 --parameter erasure-code-m=1 \
--erasure 1 --workload decode --iterations 5000
8.095007 5GB
$ ceph_erasure_code_benchmark \
--plugin jerasure --parameter erasure-code-directory=.libs \
--parameter erasure-code-technique=reed_sol_van \
--parameter erasure-code-k=10 --parameter erasure-code-m=6 \
--erasure 1 --workload decode --iterations 5000
7.870990 5GB
Signed-off-by: Loic Dachary <loic@dachary.org>
// No matter what the missing chunk is, XOR of the other
// two recovers it.
//
- bufferptr chunk(chunk_length);
map<int, bufferlist>::const_iterator k = chunks.begin();
const char *a = k->second.buffers().front().c_str();
++k;
const char *b = k->second.buffers().front().c_str();
+ bufferptr chunk(chunk_length);
+ char *c = chunk.c_str();
for (unsigned j = 0; j < chunk_length; j++) {
- chunk[j] = a[j] ^ b[j];
+ c[j] = a[j] ^ b[j];
}
(*decoded)[*i].push_front(chunk);
}