Lolly
1.4.28
Loading...
Searching...
No Matches
bench
lolly
data
string_u16_bench.cpp
Go to the documentation of this file.
1
/** \file lolly_string_bench.cpp
2
* \copyright GPLv3
3
* \details Benchmark for string
4
* \author jingkaimori
5
* \date 2024
6
*/
7
8
#include "
lolly/data/string_u16.hpp
"
9
#include <nanobench.h>
10
11
using
lolly::data::string_u16
;
12
13
static
ankerl::nanobench::Bench
bench
;
14
15
namespace
lolly
{
16
extern
void
init_tbox
();
17
}
// namespace lolly
18
19
int
20
main
() {
21
lolly::init_tbox
();
22
#ifdef OS_WASM
23
bench
.minEpochIterations (2000);
24
#else
25
bench
.minEpochIterations (200000);
26
#endif
27
bench
.run (
"construct string_u16"
, [&] {
string_u16
(); });
28
bench
.run (
"equality of string"
, [&] {
29
static
string_u16
a (
u
"abc"
),
b
;
30
a ==
b
;
31
});
32
bench
.run (
"equality of larger string"
, [&] {
33
static
string_u16
a (
u
"equality of larger string"
),
34
b
(
u
"equality of larger string"
);
35
a ==
b
;
36
});
37
bench
.run (
"compare string"
, [&] {
38
static
string_u16
a (
u
"ab"
),
b
(
u
"b"
);
39
a <=
b
;
40
});
41
bench
.run (
"compare larger string"
, [&] {
42
static
string_u16
a (
u
"compare larger string"
),
43
b
(
u
"compare LARGEr string"
);
44
a <=
b
;
45
});
46
bench
.run (
"slice string"
, [&] {
47
static
string_u16
a (
u
"abcdefgh"
);
48
a (2, 3);
49
});
50
bench
.run (
"slice string with larger range"
, [&] {
51
static
string_u16
a (
u
"abcdefgh"
);
52
a (1, 6);
53
});
54
bench
.run (
"concat string"
, [&] {
55
static
string_u16
a (
u
"abc"
),
b
(
u
"de"
);
56
a*
b
;
57
});
58
bench
.run (
"append string"
, [&] {
59
static
string_u16
a (
u
"abc"
),
b
(
u
"de"
);
60
a <<
b
;
61
});
62
}
b
blackbox b[13]
Definition
blackbox_test.cpp:41
list
The list class represents a linked list.
Definition
list.hpp:48
lolly::data::string_u16
Definition
string_u16.hpp:61
lolly
Definition
lolly_tree_bench.cpp:13
lolly::init_tbox
void init_tbox()
Definition
sys_utils.cpp:169
string_u16.hpp
bench
static ankerl::nanobench::Bench bench
Definition
string_u16_bench.cpp:13
main
int main()
Definition
string_u16_bench.cpp:20
Generated by
1.10.0