diff --git a/README.adoc b/README.adoc index 2822420..ea236b2 100644 --- a/README.adoc +++ b/README.adoc @@ -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 <> 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: <> @@ -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 diff --git a/path_properties.py b/path_properties.py index 56afd45..5aab2e7 100644 --- a/path_properties.py +++ b/path_properties.py @@ -478,9 +478,7 @@ path_properties_tuples = ( ), 'cpp': ( {}, - { - 'bst_vs_heap_vs_hashmap.cpp': {'more_than_1s': True}, - }, + {}, ), 'gcc': ( gnu_extension_properties, diff --git a/userland/cpp/bst_vs_heap_vs_hashmap.cpp b/userland/cpp/bst_vs_heap_vs_hashmap.cpp index 4fe3e3d..0e544ad 100644 --- a/userland/cpp/bst_vs_heap_vs_hashmap.cpp +++ b/userland/cpp/bst_vs_heap_vs_hashmap.cpp @@ -1,48 +1,5 @@ // https://github.com/cirosantilli/linux-kernel-module-cheat#bst-vs-heap-vs-hashmap -//#include -//#include -//#include -//#include -//#include -// -//#include -// -//int main(int argc, char **argv) { -// typedef uint64_t I; -// std::vector randoms; -// size_t i, n; -// std::priority_queue heap; -// std::set 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 #include #include @@ -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