From: Loic Dachary Date: Fri, 13 Dec 2013 13:07:37 +0000 (+0100) Subject: osd: better performances for the erasure code example X-Git-Tag: v0.75~65^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c7d8ba7b6d0bb44b54c4a0deb43b04b0facbdee7;p=ceph.git osd: better performances for the erasure code example 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 --- diff --git a/src/test/osd/ErasureCodeExample.h b/src/test/osd/ErasureCodeExample.h index 07694ea409aa..0710189cba4e 100644 --- a/src/test/osd/ErasureCodeExample.h +++ b/src/test/osd/ErasureCodeExample.h @@ -143,13 +143,14 @@ public: // No matter what the missing chunk is, XOR of the other // two recovers it. // - bufferptr chunk(chunk_length); map::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); }