[Linux] Port MallocBench
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2017 07:05:44 +0000 (07:05 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Oct 2017 07:05:44 +0000 (07:05 +0000)
commitdbf8d2a9b4466b5751601be23cbb7080fb203e05
tree5017e072a087a63f01966ecf5b5b2f3eb3681016
parent392d914ce089599bb7796f305b5a83b77ace81e5
[Linux] Port MallocBench
https://bugs.webkit.org/show_bug.cgi?id=177856

Reviewed by Filip Pizlo.

.:

* CMakeLists.txt:

PerformanceTests:

We would like to optimize locking in bmalloc in Linux by using futex APIs. So we should have
the way to ensure this actually improves / does not regress the performance.

This patch ports MallocBench to Linux to measure/ensure the effect of bmalloc patch in Linux.

While we replace the dispatch serial queue in message.cpp, we still use libdispatch in Benchmark.cpp
since we do not have priority mechanism in C++11 threading implementation.

We also extend run-malloc-benchmarks to accept cmake style layout of build product directory.
And we also support building MallocBench in CMake environment including CMake Mac ports.
Currently, we do not support Windows yet.

Based on the measurement, we can say the following observation. glibc's malloc performance is not
so bad. While bmalloc shows 3.8x (in geomean) performance improvement, bmalloc in Linux shows 2.0x
improvement. Since both numbers in bmalloc are similar, we can think that bmalloc's optimization is
actually working in Linux too. And even though glibc's malloc perofmrnace is not so bad, bmalloc
still offers performance improvement.

* CMakeLists.txt: Added.
* MallocBench/CMakeLists.txt: Added.
* MallocBench/MallocBench.xcodeproj/project.pbxproj:
* MallocBench/MallocBench/Benchmark.cpp:
(Benchmark::Benchmark):
(Benchmark::runOnce):
(Benchmark::currentMemoryBytes): Deleted.
* MallocBench/MallocBench/Benchmark.h:
(Benchmark::Memory::Memory): Deleted.
(Benchmark::Memory::operator-): Deleted.
* MallocBench/MallocBench/CMakeLists.txt: Added.
* MallocBench/MallocBench/CPUCount.cpp:
(cpuCount):
* MallocBench/MallocBench/Interpreter.cpp:
(Interpreter::doMallocOp):
* MallocBench/MallocBench/Memory.cpp: Added.
(currentMemoryBytes):
* MallocBench/MallocBench/Memory.h: Copied from PerformanceTests/MallocBench/MallocBench/CPUCount.cpp.
(Memory::Memory):
(Memory::operator-):
* MallocBench/MallocBench/balloon.cpp:
(benchmark_balloon):
* MallocBench/MallocBench/mbmalloc.cpp:
* MallocBench/MallocBench/message.cpp:
(WorkQueue::WorkQueue):
(WorkQueue::~WorkQueue):
(WorkQueue::dispatchAsync):
(WorkQueue::dispatchSync):
(benchmark_message_one):
(benchmark_message_many):
* MallocBench/MallocBench/nimlang.cpp:
(benchmark_nimlang):
* MallocBench/MallocBench/stress.cpp:
(SizeStream::next):
* MallocBench/MallocBench/stress_aligned.cpp:
* MallocBench/run-malloc-benchmarks:

Source/bmalloc:

* CMakeLists.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
CMakeLists.txt
ChangeLog
PerformanceTests/CMakeLists.txt [new file with mode: 0644]
PerformanceTests/ChangeLog
PerformanceTests/MallocBench/CMakeLists.txt [new file with mode: 0644]
PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj
PerformanceTests/MallocBench/MallocBench/Benchmark.cpp
PerformanceTests/MallocBench/MallocBench/Benchmark.h
PerformanceTests/MallocBench/MallocBench/CMakeLists.txt [new file with mode: 0644]
PerformanceTests/MallocBench/MallocBench/CPUCount.cpp
PerformanceTests/MallocBench/MallocBench/Interpreter.cpp
PerformanceTests/MallocBench/MallocBench/Memory.cpp [new file with mode: 0644]
PerformanceTests/MallocBench/MallocBench/Memory.h [new file with mode: 0644]
PerformanceTests/MallocBench/MallocBench/balloon.cpp
PerformanceTests/MallocBench/MallocBench/mbmalloc.cpp
PerformanceTests/MallocBench/MallocBench/message.cpp
PerformanceTests/MallocBench/MallocBench/nimlang.cpp
PerformanceTests/MallocBench/MallocBench/stress.cpp
PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp
PerformanceTests/MallocBench/run-malloc-benchmarks
Source/bmalloc/CMakeLists.txt
Source/bmalloc/ChangeLog