From: Sage Weil Date: Fri, 27 Sep 2013 22:29:13 +0000 (-0700) Subject: common/buffer: add crc caching performance test X-Git-Tag: v0.72-rc1~42^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=88ae8f6805a331b9d6b80f8f1301dddaa6f767c3;p=ceph.git common/buffer: add crc caching performance test On my old box: - matching cached values is a big win (free), obviously - the adjustment is the same speed as redoing the calculation. this is probably because the data is already in L1/L2 cache; we still save memory bandwidth. Signed-off-by: Sage Weil --- diff --git a/src/test/bufferlist.cc b/src/test/bufferlist.cc index beae868c0da6..7fdc4883e9b6 100644 --- a/src/test/bufferlist.cc +++ b/src/test/bufferlist.cc @@ -25,8 +25,10 @@ #include #include "include/buffer.h" +#include "include/utime.h" #include "include/encoding.h" #include "common/environment.h" +#include "common/Clock.h" #include "gtest/gtest.h" #include "stdlib.h" @@ -1649,7 +1651,7 @@ TEST(BufferList, crc32c) { EXPECT_EQ((unsigned)0x5FA5C0CC, crc); } -TEST(BufferList, crc32cappend) { +TEST(BufferList, crc32c_append) { bufferlist bl1; bufferlist bl2; @@ -1666,6 +1668,145 @@ TEST(BufferList, crc32cappend) { ASSERT_EQ(bl1.crc32c(0), bl2.crc32c(0)); } +TEST(BufferList, crc32c_append_perf) { + int len = 256 * 1024 * 1024; + bufferptr a(len); + bufferptr b(len); + bufferptr c(len); + bufferptr d(len); + std::cout << "populating large buffers (a, b=c=d)" << std::endl; + char *pa = a.c_str(); + char *pb = b.c_str(); + char *pc = c.c_str(); + char *pd = c.c_str(); + for (int i=0; i