-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmarks.convert_functions.cpp
More file actions
52 lines (46 loc) · 2.05 KB
/
Copy pathbenchmarks.convert_functions.cpp
File metadata and controls
52 lines (46 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "nonius.h++"
#include "convert_functions.h"
#include "random_data_generator.h"
#include <memory>
#include <list>
#include <forward_list>
// NONIUS_BENCHMARK("list<long long>", [](nonius::chronometer meter) {
// std::list<long long> l;
// meter.measure([&](int i) { l.push_front(i); });
// })
NONIUS_BENCHMARK("convert_hex_string_naive_sscanf", [](nonius::chronometer meter) {
constexpr size_t data_length = 1024; //83886080;
auto input = random_data_generator(data_length);
auto output = std::make_unique<char[]>(data_length);
meter.measure([input = move(input), output = move(output), data_length](int i)
{
return convert_hex_string_naive_sscanf(input.get(), output.get(), data_length);
});
})
NONIUS_BENCHMARK("convert_hex_string_naive_strtoul", [](nonius::chronometer meter) {
constexpr size_t data_length = 1024; //83886080;
auto input = random_data_generator(data_length);
auto output = std::make_unique<char[]>(data_length);
meter.measure([input = move(input), output = move(output), data_length](int i)
{
return convert_hex_string_naive_strtoul(input.get(), output.get(), data_length);
});
})
NONIUS_BENCHMARK("convert_hex_string_naive_lookup", [](nonius::chronometer meter) {
constexpr size_t data_length = 1024; //83886080;
auto input = random_data_generator(data_length);
auto output = std::make_unique<char[]>(data_length);
meter.measure([input = move(input), output = move(output), data_length](int i)
{
return convert_hex_string_naive_lookup(input.get(), output.get(), data_length);
});
})
NONIUS_BENCHMARK("convert_hex_string_calculated", [](nonius::chronometer meter) {
constexpr size_t data_length = 1024; //83886080;
auto input = random_data_generator(data_length);
auto output = std::make_unique<char[]>(data_length);
meter.measure([input = move(input), output = move(output), data_length](int i)
{
return convert_hex_string_calculated(input.get(), output.get(), data_length);
});
})