File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ add_executable(bench_bitcoin
35
35
mempool_eviction.cpp
36
36
mempool_stress.cpp
37
37
merkle_root.cpp
38
+ obfuscation.cpp
38
39
parse_hex.cpp
39
40
peer_eviction.cpp
40
41
poly1305.cpp
@@ -51,7 +52,6 @@ add_executable(bench_bitcoin
51
52
txgraph.cpp
52
53
util_time.cpp
53
54
verify_script.cpp
54
- xor.cpp
55
55
)
56
56
57
57
include (TargetDataSources )
Original file line number Diff line number Diff line change 4
4
5
5
#include < bench/bench.h>
6
6
#include < random.h>
7
- #include < span.h>
8
7
#include < streams.h>
9
8
#include < util/obfuscation.h>
10
9
11
10
#include < cstddef>
12
11
#include < vector>
13
12
14
- static void Xor (benchmark::Bench& bench)
13
+ static void ObfuscationBench (benchmark::Bench& bench)
15
14
{
16
15
FastRandomContext frc{/* fDeterministic=*/ true };
17
16
auto data{frc.randbytes <std::byte>(1024 )};
18
- auto key{frc.randbytes <std::byte>( Obfuscation::KEY_SIZE)};
17
+ const auto key{frc.randbytes <Obfuscation::KEY_SIZE>( )};
19
18
19
+ size_t offset{0 };
20
20
bench.batch (data.size ()).unit (" byte" ).run ([&] {
21
- util::Xor (data, key);
21
+ util::Xor (data, key, offset++); // mutated differently each time
22
+ ankerl::nanobench::doNotOptimizeAway (data);
22
23
});
23
24
}
24
25
25
- BENCHMARK (Xor , benchmark::PriorityLevel::HIGH);
26
+ BENCHMARK (ObfuscationBench , benchmark::PriorityLevel::HIGH);
You can’t perform that action at this time.
0 commit comments