Skip to content

Commit 52a203a

Browse files
committed
bst_vs_heap_vs_hashmap: use small size by default
This allows us to add it to regressions. Also clarify that the gem5 run blew up.
1 parent b7318fb commit 52a203a

File tree

3 files changed

+11
-49
lines changed

3 files changed

+11
-49
lines changed

README.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10227,7 +10227,7 @@ To benchmark on the host, we do:
1022710227

1022810228
....
1022910229
./build-userland-in-tree --force-rebuild --optimization-level 3 ./userland/cpp/bst_vs_heap_vs_hashmap.cpp
10230-
./userland/cpp/bst_vs_heap_vs_hashmap.out | tee bst_vs_heap_vs_hashmap.dat
10230+
./userland/cpp/bst_vs_heap_vs_hashmap.out 10000000 10000 | tee bst_vs_heap_vs_hashmap.dat
1023110231
gnuplot \
1023210232
-e 'input_noext="bst_vs_heap_vs_hashmap"' \
1023310233
-e 'heap_zoom_max=50' \
@@ -10274,6 +10274,8 @@ gnuplot \
1027410274
xdg-open bst_vs_heap_vs_hashmap_gem5.tmp.png
1027510275
....
1027610276

10277+
TODO: the gem5 simulation blows up on a tcmalloc allocation somewhere near 25k elements as of 3fdd83c2c58327d9714fa2347c724b78d7c05e2b + 1, likely linked to the extreme inefficiency of the stats collection?
10278+
1027710279
The cache sizes were chosen to match the host <<p51>> to improve the comparison. Ideally we sould also use the same standard library.
1027810280

1027910281
Note that this will take a long time, and will produce a humongous ~40Gb stats file due to: <<gem5-only-dump-selected-stats>>
@@ -14060,6 +14062,11 @@ That document then describes the SVE instructions and registers.
1406014062

1406114063
* LDADD: link:userland/cpp/atomic.cpp[]
1406214064

14065+
Bibliography:
14066+
14067+
* https://stackoverflow.com/questions/21535058/arm64-ldxr-stxr-vs-ldaxr-stlxr
14068+
* https://preshing.com/20120710/memory-barriers-are-like-source-control-operations/
14069+
1406314070
=== ARM assembly bibliography
1406414071

1406514072
==== ARM non-official bibliography

path_properties.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,7 @@ def get(path):
478478
),
479479
'cpp': (
480480
{},
481-
{
482-
'bst_vs_heap_vs_hashmap.cpp': {'more_than_1s': True},
483-
},
481+
{},
484482
),
485483
'gcc': (
486484
gnu_extension_properties,

userland/cpp/bst_vs_heap_vs_hashmap.cpp

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
11
// https://github.com/cirosantilli/linux-kernel-module-cheat#bst-vs-heap-vs-hashmap
22

3-
//#include <algorithm>
4-
//#include <iostream>
5-
//#include <queue>
6-
//#include <random>
7-
//#include <set>
8-
//
9-
//#include <lkmc/m5ops.h>
10-
//
11-
//int main(int argc, char **argv) {
12-
// typedef uint64_t I;
13-
// std::vector<I> randoms;
14-
// size_t i, n;
15-
// std::priority_queue<I> heap;
16-
// std::set<I> bst;
17-
// unsigned int seed = std::random_device()();
18-
//
19-
// // CLI arguments.
20-
// if (argc > 1) {
21-
// n = std::stoi(argv[1]);
22-
// } else {
23-
// n = 1;
24-
// }
25-
//
26-
// // Action.
27-
// for (i = 0; i < n; ++i) {
28-
// randoms.push_back(i);
29-
// }
30-
// std::shuffle(randoms.begin(), randoms.end(), std::mt19937(seed));
31-
// for (i = 0; i < n; ++i) {
32-
// auto random = randoms[i];
33-
//
34-
// // Heap.
35-
// LKMC_M5OPS_RESETSTATS;
36-
// heap.emplace(random);
37-
// LKMC_M5OPS_DUMPSTATS;
38-
//
39-
// // BST.
40-
// LKMC_M5OPS_RESETSTATS;
41-
// bst.insert(random);
42-
// LKMC_M5OPS_DUMPSTATS;
43-
// }
44-
//}
45-
463
#include <algorithm>
474
#include <cassert>
485
#include <chrono>
@@ -67,7 +24,7 @@ int main(int argc, char **argv) {
6724
if (argc > 1) {
6825
n = std::stoi(argv[1]);
6926
} else {
70-
n = 10000000;
27+
n = 10;
7128
}
7229
#ifdef LKMC_M5OPS_ENABLE
7330
// Let's comment useless stuff out to speed up gem5 simulations.
@@ -77,7 +34,7 @@ int main(int argc, char **argv) {
7734
if (argc > 2) {
7835
granule = std::stoi(argv[2]);
7936
} else {
80-
granule = 10000;
37+
granule = 1;
8138
}
8239
#endif
8340

0 commit comments

Comments
 (0)