]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: better performances for the erasure code example
authorLoic Dachary <loic@dachary.org>
Fri, 13 Dec 2013 13:07:37 +0000 (14:07 +0100)
committerLoic Dachary <loic@dachary.org>
Fri, 20 Dec 2013 10:28:47 +0000 (11:28 +0100)
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>
src/test/osd/ErasureCodeExample.h

index 07694ea409aaecf64524097df85785e476b66a3c..0710189cba4eeb7295b5a2a9f436c9447e2e44ee 100644 (file)
@@ -143,13 +143,14 @@ public:
        // 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);
       }