diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/testing/benchmark/examples | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/benchmark/examples')
-rw-r--r-- | library/cpp/testing/benchmark/examples/main.cpp | 82 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/examples/metrics/main.py | 12 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/examples/metrics/ya.make | 28 | ||||
-rw-r--r-- | library/cpp/testing/benchmark/examples/ya.make | 10 |
4 files changed, 66 insertions, 66 deletions
diff --git a/library/cpp/testing/benchmark/examples/main.cpp b/library/cpp/testing/benchmark/examples/main.cpp index ddd8b05ffc..745e636d4c 100644 --- a/library/cpp/testing/benchmark/examples/main.cpp +++ b/library/cpp/testing/benchmark/examples/main.cpp @@ -120,9 +120,9 @@ Y_CPU_BENCHMARK(FunctionCallCost_StringBufVal1, iface) { for (auto i : xrange<size_t>(0, iface.Iterations())) { (void)i; - NBench::Escape(&x); + NBench::Escape(&x); Y_DO_NOT_OPTIMIZE_AWAY(FS1(x)); - NBench::Clobber(); + NBench::Clobber(); } } @@ -131,9 +131,9 @@ Y_CPU_BENCHMARK(FunctionCallCost_StringBufRef1, iface) { for (auto i : xrange<size_t>(0, iface.Iterations())) { (void)i; - NBench::Escape(&x); + NBench::Escape(&x); Y_DO_NOT_OPTIMIZE_AWAY(FS2(x)); - NBench::Clobber(); + NBench::Clobber(); } } @@ -143,10 +143,10 @@ Y_CPU_BENCHMARK(FunctionCallCost_StringBufVal2, iface) { for (auto i : xrange<size_t>(0, iface.Iterations())) { (void)i; - NBench::Escape(&x); - NBench::Escape(&y); + NBench::Escape(&x); + NBench::Escape(&y); Y_DO_NOT_OPTIMIZE_AWAY(FS1_2(x, y)); - NBench::Clobber(); + NBench::Clobber(); } } @@ -156,10 +156,10 @@ Y_CPU_BENCHMARK(FunctionCallCost_StringBufRef2, iface) { for (auto i : xrange<size_t>(0, iface.Iterations())) { (void)i; - NBench::Escape(&x); - NBench::Escape(&y); + NBench::Escape(&x); + NBench::Escape(&y); Y_DO_NOT_OPTIMIZE_AWAY(FS2_2(x, y)); - NBench::Clobber(); + NBench::Clobber(); } } @@ -181,35 +181,35 @@ Y_CPU_BENCHMARK(FunctionCallCost_TwoArg, iface) { Y_DO_NOT_OPTIMIZE_AWAY(FFF(i, i)); } } - -/* An example of incorrect benchmark. As of r2581591 Clang 3.7 produced following assembly: - * @code - * │ push %rbp - * │ mov %rsp,%rbp - * │ push %rbx - * │ push %rax - * │ mov (%rdi),%rbx - * │ test %rbx,%rbx - * │ ↓ je 25 - * │ xor %edi,%edi - * │ xor %esi,%esi + +/* An example of incorrect benchmark. As of r2581591 Clang 3.7 produced following assembly: + * @code + * │ push %rbp + * │ mov %rsp,%rbp + * │ push %rbx + * │ push %rax + * │ mov (%rdi),%rbx + * │ test %rbx,%rbx + * │ ↓ je 25 + * │ xor %edi,%edi + * │ xor %esi,%esi * │ → callq FS1(TBasicStringBuf<char, std::char_traits<char - * │ nop - * 100.00 │20:┌─→dec %rbx - * │ └──jne 20 - * │25: add $0x8,%rsp - * │ pop %rbx - * │ pop %rbp - * │ ← retq - * @endcode - * - * So, this benchmark is measuring empty loop! - */ -Y_CPU_BENCHMARK(Incorrect_FunctionCallCost_StringBufVal1, iface) { - TStringBuf x; - - for (auto i : xrange<size_t>(0, iface.Iterations())) { - (void)i; - Y_DO_NOT_OPTIMIZE_AWAY(FS1(x)); - } -} + * │ nop + * 100.00 │20:┌─→dec %rbx + * │ └──jne 20 + * │25: add $0x8,%rsp + * │ pop %rbx + * │ pop %rbp + * │ ← retq + * @endcode + * + * So, this benchmark is measuring empty loop! + */ +Y_CPU_BENCHMARK(Incorrect_FunctionCallCost_StringBufVal1, iface) { + TStringBuf x; + + for (auto i : xrange<size_t>(0, iface.Iterations())) { + (void)i; + Y_DO_NOT_OPTIMIZE_AWAY(FS1(x)); + } +} diff --git a/library/cpp/testing/benchmark/examples/metrics/main.py b/library/cpp/testing/benchmark/examples/metrics/main.py index 8f9d9d06ae..d826450400 100644 --- a/library/cpp/testing/benchmark/examples/metrics/main.py +++ b/library/cpp/testing/benchmark/examples/metrics/main.py @@ -1,7 +1,7 @@ -import yatest.common as yc - - -def test_export_metrics(metrics): - metrics.set_benchmark(yc.execute_benchmark( +import yatest.common as yc + + +def test_export_metrics(metrics): + metrics.set_benchmark(yc.execute_benchmark( 'library/cpp/testing/benchmark/examples/examples', - threads=8)) + threads=8)) diff --git a/library/cpp/testing/benchmark/examples/metrics/ya.make b/library/cpp/testing/benchmark/examples/metrics/ya.make index a9dbdca9fa..a2c773a2d0 100644 --- a/library/cpp/testing/benchmark/examples/metrics/ya.make +++ b/library/cpp/testing/benchmark/examples/metrics/ya.make @@ -1,20 +1,20 @@ -OWNER( - pg - yazevnul -) - +OWNER( + pg + yazevnul +) + PY2TEST() - + SIZE(LARGE) - -TAG( + +TAG( ya:force_sandbox - sb:intel_e5_2660v1 + sb:intel_e5_2660v1 ya:fat -) - +) + TEST_SRCS(main.py) - + DEPENDS(library/cpp/testing/benchmark/examples) - -END() + +END() diff --git a/library/cpp/testing/benchmark/examples/ya.make b/library/cpp/testing/benchmark/examples/ya.make index 7e696e127a..d0d5bdca2c 100644 --- a/library/cpp/testing/benchmark/examples/ya.make +++ b/library/cpp/testing/benchmark/examples/ya.make @@ -1,8 +1,8 @@ -OWNER( - pg - yazevnul -) - +OWNER( + pg + yazevnul +) + Y_BENCHMARK() SRCS( |