mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
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.
This commit is contained in:
@@ -10227,7 +10227,7 @@ To benchmark on the host, we do:
|
||||
|
||||
....
|
||||
./build-userland-in-tree --force-rebuild --optimization-level 3 ./userland/cpp/bst_vs_heap_vs_hashmap.cpp
|
||||
./userland/cpp/bst_vs_heap_vs_hashmap.out | tee bst_vs_heap_vs_hashmap.dat
|
||||
./userland/cpp/bst_vs_heap_vs_hashmap.out 10000000 10000 | tee bst_vs_heap_vs_hashmap.dat
|
||||
gnuplot \
|
||||
-e 'input_noext="bst_vs_heap_vs_hashmap"' \
|
||||
-e 'heap_zoom_max=50' \
|
||||
@@ -10274,6 +10274,8 @@ gnuplot \
|
||||
xdg-open bst_vs_heap_vs_hashmap_gem5.tmp.png
|
||||
....
|
||||
|
||||
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?
|
||||
|
||||
The cache sizes were chosen to match the host <<p51>> to improve the comparison. Ideally we sould also use the same standard library.
|
||||
|
||||
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.
|
||||
|
||||
* LDADD: link:userland/cpp/atomic.cpp[]
|
||||
|
||||
Bibliography:
|
||||
|
||||
* https://stackoverflow.com/questions/21535058/arm64-ldxr-stxr-vs-ldaxr-stlxr
|
||||
* https://preshing.com/20120710/memory-barriers-are-like-source-control-operations/
|
||||
|
||||
=== ARM assembly bibliography
|
||||
|
||||
==== ARM non-official bibliography
|
||||
|
||||
@@ -478,9 +478,7 @@ path_properties_tuples = (
|
||||
),
|
||||
'cpp': (
|
||||
{},
|
||||
{
|
||||
'bst_vs_heap_vs_hashmap.cpp': {'more_than_1s': True},
|
||||
},
|
||||
{},
|
||||
),
|
||||
'gcc': (
|
||||
gnu_extension_properties,
|
||||
|
||||
@@ -1,48 +1,5 @@
|
||||
// https://github.com/cirosantilli/linux-kernel-module-cheat#bst-vs-heap-vs-hashmap
|
||||
|
||||
//#include <algorithm>
|
||||
//#include <iostream>
|
||||
//#include <queue>
|
||||
//#include <random>
|
||||
//#include <set>
|
||||
//
|
||||
//#include <lkmc/m5ops.h>
|
||||
//
|
||||
//int main(int argc, char **argv) {
|
||||
// typedef uint64_t I;
|
||||
// std::vector<I> randoms;
|
||||
// size_t i, n;
|
||||
// std::priority_queue<I> heap;
|
||||
// std::set<I> bst;
|
||||
// unsigned int seed = std::random_device()();
|
||||
//
|
||||
// // CLI arguments.
|
||||
// if (argc > 1) {
|
||||
// n = std::stoi(argv[1]);
|
||||
// } else {
|
||||
// n = 1;
|
||||
// }
|
||||
//
|
||||
// // Action.
|
||||
// for (i = 0; i < n; ++i) {
|
||||
// randoms.push_back(i);
|
||||
// }
|
||||
// std::shuffle(randoms.begin(), randoms.end(), std::mt19937(seed));
|
||||
// for (i = 0; i < n; ++i) {
|
||||
// auto random = randoms[i];
|
||||
//
|
||||
// // Heap.
|
||||
// LKMC_M5OPS_RESETSTATS;
|
||||
// heap.emplace(random);
|
||||
// LKMC_M5OPS_DUMPSTATS;
|
||||
//
|
||||
// // BST.
|
||||
// LKMC_M5OPS_RESETSTATS;
|
||||
// bst.insert(random);
|
||||
// LKMC_M5OPS_DUMPSTATS;
|
||||
// }
|
||||
//}
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <chrono>
|
||||
@@ -67,7 +24,7 @@ int main(int argc, char **argv) {
|
||||
if (argc > 1) {
|
||||
n = std::stoi(argv[1]);
|
||||
} else {
|
||||
n = 10000000;
|
||||
n = 10;
|
||||
}
|
||||
#ifdef LKMC_M5OPS_ENABLE
|
||||
// Let's comment useless stuff out to speed up gem5 simulations.
|
||||
@@ -77,7 +34,7 @@ int main(int argc, char **argv) {
|
||||
if (argc > 2) {
|
||||
granule = std::stoi(argv[2]);
|
||||
} else {
|
||||
granule = 10000;
|
||||
granule = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user