[PATCH] D71104: scudo: Add a basic malloc/free benchmark.

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 07:24:48 PST 2019


hctim added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp:33
+    auto *Data = reinterpret_cast<uint8_t *>(Ptr);
+    for (size_t I = 0; I < NBytes; I += PageSize)
+      Data[I] = 1;
----------------
Can we instead do what bionic-benchmarks does on their malloc test, and touch each page to ensure residency (although we're only allocating 8-bytes at a time).

Similarly, they also bulk allocate -> bulk deallocate using a storage vector. Seems like a better solution - so we don't just hit the freelist `128 * 1024` times.


================
Comment at: compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp:42
+
+BENCHMARK_TEMPLATE(BM_malloc_free, scudo::AndroidConfig)->Range(8, 128 * 1024);
+BENCHMARK_TEMPLATE(BM_malloc_free, scudo::AndroidSvelteConfig)
----------------
Missing `DefaultConfig`?


================
Comment at: compiler-rt/lib/scudo/standalone/benchmarks/malloc_benchmark.cpp:46
+#if SCUDO_CAN_USE_PRIMARY64
+BENCHMARK_TEMPLATE(BM_malloc_free, scudo::FuchsiaConfig)->Range(8, 128 * 1024);
+#endif
----------------
Can we make `128 * 1024` and `8` constants?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71104/new/

https://reviews.llvm.org/D71104





More information about the llvm-commits mailing list