haikuwebkit/PerformanceTests/MallocBench/run-malloc-benchmarks

397 lines
10 KiB
Plaintext
Raw Permalink Normal View History

Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
#!/usr/bin/env ruby
# coding: utf-8
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
require 'getoptlong'
require 'pathname'
bmalloc: Misc improvements to MallocBench https://bugs.webkit.org/show_bug.cgi?id=157004 Reviewed by Darin Adler. * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning modes for focused memory testing. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::printReport): Clarified output. (Benchmark::currentMemoryBytes): Added compressed memory because top does the same. (It always happens to zero in the benchmarks we run. But this is good for sanity.) * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce variance. * MallocBench/MallocBench/alloc_free.cpp: (benchmark_alloc_free): Cycle a single allocation in order to stress the effect of merging on calls to madvise. * MallocBench/MallocBench/big.cpp: (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and our large allocator doesn't kick in until 64kB. * MallocBench/MallocBench/medium.cpp: (benchmark_medium): Test all the way down to 1kB because our large allocator used to service 1kB allocations and 1kB is an interesting middle size where memory is unusually large but allocation throughput still matters. * MallocBench/MallocBench/stress.cpp: (benchmark_stress): Reduced the churn count to match stress_aligned because this test was taking too long to complete. * MallocBench/MallocBench/stress_aligned.cpp: (benchmark_stress_aligned): Our new large allocator can handle even more absurdly large values. Canonical link: https://commits.webkit.org/175116@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 23:50:25 +00:00
$benchmarks_all = [
# Single-threaded benchmarks.
"churn",
"list_allocate",
"tree_allocate",
"tree_churn",
"fragment",
"fragment_iterate",
"medium",
"big",
# Benchmarks based on browser recordings.
"facebook",
"reddit",
"flickr",
"theverge",
"nimlang",
# Multi-threaded benchmark variants.
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
"message_one",
"message_many",
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
"churn --parallel",
"list_allocate --parallel",
"tree_allocate --parallel",
"tree_churn --parallel",
"fragment --parallel",
"fragment_iterate --parallel",
# These tests often crash TCMalloc: <rdar://problem/13657137>.
"medium --parallel",
"big --parallel",
# Enable these tests to test memory footprint. The way they run is not
# really compatible with throughput testing.
# "reddit_memory_warning --runs 0",
# "flickr_memory_warning --runs 0",
# "theverge_memory_warning --runs 0",
# Enable this test to test shrinking back down from a large heap while a process remains active.
# The way it runs is not really compatible with throughput testing.
# "balloon"
"facebook --parallel",
"reddit --parallel",
"flickr --parallel",
"theverge --parallel",
# "nimlang --use-thread-id",
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
]
bmalloc: Misc improvements to MallocBench https://bugs.webkit.org/show_bug.cgi?id=157004 Reviewed by Darin Adler. * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning modes for focused memory testing. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::printReport): Clarified output. (Benchmark::currentMemoryBytes): Added compressed memory because top does the same. (It always happens to zero in the benchmarks we run. But this is good for sanity.) * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce variance. * MallocBench/MallocBench/alloc_free.cpp: (benchmark_alloc_free): Cycle a single allocation in order to stress the effect of merging on calls to madvise. * MallocBench/MallocBench/big.cpp: (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and our large allocator doesn't kick in until 64kB. * MallocBench/MallocBench/medium.cpp: (benchmark_medium): Test all the way down to 1kB because our large allocator used to service 1kB allocations and 1kB is an interesting middle size where memory is unusually large but allocation throughput still matters. * MallocBench/MallocBench/stress.cpp: (benchmark_stress): Reduced the churn count to match stress_aligned because this test was taking too long to complete. * MallocBench/MallocBench/stress_aligned.cpp: (benchmark_stress_aligned): Our new large allocator can handle even more absurdly large values. Canonical link: https://commits.webkit.org/175116@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 23:50:25 +00:00
$benchmarks_memory = [
"facebook",
"reddit",
"flickr",
"theverge",
"nimlang"
]
$benchmarks_memory_warning = [
"reddit_memory_warning --runs 0",
"flickr_memory_warning --runs 0",
"theverge_memory_warning --runs 0",
]
$benchmarks = $benchmarks_all
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
$heap = 0
def usage
puts "run-malloc-benchmarks [options] /path/to/MallocBench Name:/path/to/libmbmalloc.dylib [ Name:/path/to/libmbmalloc.dylib ]"
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
puts
puts " Runs a suite of memory allocation and access benchmarks."
puts
puts " <Name:/path/to/libmbmalloc.dylib> is a symbolic name followed by a path to libmbmalloc.dylib."
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
puts
puts " Specify \"SystemMalloc\" to test the built-in libc malloc."
puts " Specify \"NanoMalloc\" to test the built-in libc malloc using the NanoMalloc zone."
puts
puts " Example usage:"
puts
puts " run-malloc-benchmarks /BUILD/MallocBench SystemMalloc:/BUILD/libmbmalloc.dylib NanoMalloc:/BUILD/libmbmalloc.dylib"
puts " run-malloc-benchmarks /BUILD/MallocBench FastMalloc:/BUILD/FastMalloc/libmbmalloc.dylib"
puts " run-malloc-benchmarks --benchmark churn SystemMalloc:/BUILD/libmbmalloc.dylib FastMalloc:/BUILD/FastMalloc/libmbmalloc.dylib"
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
puts
puts "Options:"
puts
puts " --benchmark <benchmark> Select a single benchmark to run instead of the full suite."
[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: Canonical link: https://commits.webkit.org/194175@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-05 07:05:44 +00:00
puts " --heap <heap> Set a baseline heap size."
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
puts
end
class Dylib
attr_reader :name
attr_reader :path
def initialize(name, path)
@name = name
@path = path
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
end
class Results
attr_reader :executionTime
attr_reader :peakMemory
attr_reader :memoryAtEnd
def initialize(executionTime, peakMemory, memoryAtEnd)
@executionTime = executionTime
@peakMemory = peakMemory
@memoryAtEnd = memoryAtEnd
end
end
class Stat
attr_reader :benchmark
attr_reader :result
def initialize(benchmark, result)
@benchmark = benchmark
@result = result[/\d+/].to_i
end
end
class TimeStat < Stat
def to_s
@result + "ms"
end
end
class MemoryStat < Stat
def to_s
@result + "kB"
end
end
class PeakMemoryStat < Stat
def to_s
@result + "kB"
end
end
def lpad(str, chars)
if str.length > chars
str
else
"%#{chars}s"%(str)
end
end
def rpad(str, chars)
while str.length < chars
str += " "
end
str
end
def computeArithmeticMean(array)
sum = 0.0
array.each {
| value |
sum += value
}
(sum / array.length)
end
def computeGeometricMean(array)
mult = 1.0
array.each {
| value |
mult *= value ? value : 1.0
}
(mult ** (1.0 / array.length))
end
def computeHarmonicMean(array)
1.0 / computeArithmeticMean(array.collect{ | value | 1.0 / value })
end
def lowerIsBetter(a, b, better, worse)
if b < a
return "^ " + (a.to_f / b.to_f).round(2).to_s + "x " + better
end
if b == a
return ""
end
"! " + (b.to_f / a.to_f).round(2).to_s + "x " + worse
end
def lowerIsFaster(a, b)
lowerIsBetter(a, b, "faster", "slower")
end
def lowerIsSmaller(a, b)
lowerIsBetter(a, b, "smaller", "bigger")
end
def numberWithDelimiter(number)
number.to_s.reverse.gsub(/...(?=.)/,'\&,').reverse
end
def prettify(number, suffix)
numberWithDelimiter(number) + suffix
end
def parseOptions
GetoptLong.new(
['--benchmark', GetoptLong::REQUIRED_ARGUMENT],
bmalloc: Misc improvements to MallocBench https://bugs.webkit.org/show_bug.cgi?id=157004 Reviewed by Darin Adler. * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning modes for focused memory testing. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::printReport): Clarified output. (Benchmark::currentMemoryBytes): Added compressed memory because top does the same. (It always happens to zero in the benchmarks we run. But this is good for sanity.) * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce variance. * MallocBench/MallocBench/alloc_free.cpp: (benchmark_alloc_free): Cycle a single allocation in order to stress the effect of merging on calls to madvise. * MallocBench/MallocBench/big.cpp: (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and our large allocator doesn't kick in until 64kB. * MallocBench/MallocBench/medium.cpp: (benchmark_medium): Test all the way down to 1kB because our large allocator used to service 1kB allocations and 1kB is an interesting middle size where memory is unusually large but allocation throughput still matters. * MallocBench/MallocBench/stress.cpp: (benchmark_stress): Reduced the churn count to match stress_aligned because this test was taking too long to complete. * MallocBench/MallocBench/stress_aligned.cpp: (benchmark_stress_aligned): Our new large allocator can handle even more absurdly large values. Canonical link: https://commits.webkit.org/175116@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 23:50:25 +00:00
['--memory', GetoptLong::NO_ARGUMENT],
['--memory_warning', GetoptLong::NO_ARGUMENT],
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
['--heap', GetoptLong::REQUIRED_ARGUMENT],
['--help', GetoptLong::NO_ARGUMENT],
).each {
| opt, arg |
case opt
when '--benchmark'
$benchmarks = [ arg ]
bmalloc: Misc improvements to MallocBench https://bugs.webkit.org/show_bug.cgi?id=157004 Reviewed by Darin Adler. * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning modes for focused memory testing. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::printReport): Clarified output. (Benchmark::currentMemoryBytes): Added compressed memory because top does the same. (It always happens to zero in the benchmarks we run. But this is good for sanity.) * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce variance. * MallocBench/MallocBench/alloc_free.cpp: (benchmark_alloc_free): Cycle a single allocation in order to stress the effect of merging on calls to madvise. * MallocBench/MallocBench/big.cpp: (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and our large allocator doesn't kick in until 64kB. * MallocBench/MallocBench/medium.cpp: (benchmark_medium): Test all the way down to 1kB because our large allocator used to service 1kB allocations and 1kB is an interesting middle size where memory is unusually large but allocation throughput still matters. * MallocBench/MallocBench/stress.cpp: (benchmark_stress): Reduced the churn count to match stress_aligned because this test was taking too long to complete. * MallocBench/MallocBench/stress_aligned.cpp: (benchmark_stress_aligned): Our new large allocator can handle even more absurdly large values. Canonical link: https://commits.webkit.org/175116@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 23:50:25 +00:00
when '--memory'
$benchmarks = $benchmarks_memory
when '--memory_warning'
$benchmarks = $benchmarks_memory_warning
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
when '--heap'
$heap = arg
when '--help'
usage
exit 1
else
raise "bad option: #{opt}"
end
}
if ARGV.length < 1
puts "Error: No MallocBench specified."
exit 1
[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: Canonical link: https://commits.webkit.org/194175@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-05 07:05:44 +00:00
end
if ARGV.length < 2
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
puts "Error: No dylib specified."
exit 1
end
$mallocBench = File.absolute_path(ARGV.shift)
if !File.exists?($mallocBench)
puts "File not found: #{$mallocBench}."
exit 1
end
$buildDir = Pathname.new($mallocBench).dirname
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
dylibs = []
ARGV.each {
| arg |
name, path = arg.split(":")
if !name || name.length < 1 ||
!path || path.length < 1
puts "Invalid <Name:/path/to/dylib>: '#{arg}'."
exit 1
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
dylib = Dylib.new(name, File.expand_path(path))
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
if !File.exists?(dylib.path)
puts "File not found: #{dylib.path}."
exit 1
end
dylibs.push(dylib)
}
dylibs
end
def runBenchmarks(dylibs)
executionTime = []
peakMemory = []
memoryAtEnd = []
$benchmarks.each {
| benchmark |
executionTime.push([])
peakMemory.push([])
memoryAtEnd.push([])
dylibs.each {
| dylib |
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
$stderr.print "\rRUNNING #{dylib.name}: #{benchmark}... "
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
env = "DYLD_LIBRARY_PATH='#{Pathname.new(dylib.path).dirname}' "
[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: Canonical link: https://commits.webkit.org/194175@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-05 07:05:44 +00:00
env += "LD_LIBRARY_PATH='#{Pathname.new(dylib.path).dirname}' "
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
if dylib.name == "NanoMalloc"
env += "MallocNanoZone=1 "
elsif dylib.name == "SystemMalloc"
env += "MallocNanoZone=0 "
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
input = "cd '#{$buildDir}'; #{env} '#{$mallocBench}' --benchmark #{benchmark} --heap #{$heap}}"
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
output =`#{input}`
splitOutput = output.split("\n")
executionTime[-1].push(TimeStat.new(benchmark, splitOutput[1]))
bmalloc: Misc improvements to MallocBench https://bugs.webkit.org/show_bug.cgi?id=157004 Reviewed by Darin Adler. * MallocBench/run-malloc-benchmarks: Added --memory and --memory_warning modes for focused memory testing. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::printReport): Clarified output. (Benchmark::currentMemoryBytes): Added compressed memory because top does the same. (It always happens to zero in the benchmarks we run. But this is good for sanity.) * MallocBench/MallocBench/CommandLine.cpp: Moved up to 8 runs to reduce variance. * MallocBench/MallocBench/alloc_free.cpp: (benchmark_alloc_free): Cycle a single allocation in order to stress the effect of merging on calls to madvise. * MallocBench/MallocBench/big.cpp: (benchmark_big): Graduated to 8kB-128kB because medium tests up to 8 and our large allocator doesn't kick in until 64kB. * MallocBench/MallocBench/medium.cpp: (benchmark_medium): Test all the way down to 1kB because our large allocator used to service 1kB allocations and 1kB is an interesting middle size where memory is unusually large but allocation throughput still matters. * MallocBench/MallocBench/stress.cpp: (benchmark_stress): Reduced the churn count to match stress_aligned because this test was taking too long to complete. * MallocBench/MallocBench/stress_aligned.cpp: (benchmark_stress_aligned): Our new large allocator can handle even more absurdly large values. Canonical link: https://commits.webkit.org/175116@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200060 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-04-25 23:50:25 +00:00
peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[2] : "0"))
memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[3] : "0"))
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
}
}
$stderr.print "\r \n"
Results.new(executionTime, peakMemory, memoryAtEnd)
end
def printResults(dylibs, results)
def printHeader(dylibs, fieldSize)
print
print lpad("", fieldSize)
print lpad(dylibs[0].name, fieldSize)
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
if dylibs.length > 1
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
print lpad(dylibs[1].name, fieldSize)
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
print lpad("Δ", fieldSize)
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
print "\n"
end
def printMetric(name, results, compareFunction, suffix, fieldSize)
def printMean(name, results, meanFunction, compareFunction, suffix, fieldSize)
means = []
means.push(meanFunction.call(results.collect { | stats | stats[0].result }))
print rpad(" " + name, fieldSize)
print lpad("#{prettify(means[0].round, suffix)}", fieldSize)
if results[0][1]
means.push(meanFunction.call(results.collect { | stats | stats[1].result }))
print lpad("#{prettify(means[1].round, suffix)}", fieldSize)
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
print lpad(compareFunction.call(means[0], means[1]), fieldSize)
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
print "\n"
end
if results[0][0].result == 0
return
end
print name + ":\n"
results.each {
| stats |
print rpad(" " + stats[0].benchmark, fieldSize)
print lpad("#{prettify(stats[0].result, suffix)}", fieldSize)
if stats[1]
print lpad("#{prettify(stats[1].result, suffix)}", fieldSize)
Added some more Membuster recordings to MallocBench https://bugs.webkit.org/show_bug.cgi?id=131862 Reviewed by Sam Weinig. * MallocBench/MallocBench/Benchmark.cpp: (Benchmark::Benchmark): (Benchmark::run): * MallocBench/MallocBench/Benchmark.h: * MallocBench/MallocBench/CommandLine.cpp: * MallocBench/MallocBench/CommandLine.h: (CommandLine::runs): Added a --runs option, so we can specify zero runs for memory warning benchmarks. Those benchmarks want zero runs so that they can perform a single warmup, which does not free all allocated objects, and then see how far back to 0MB they can get. Running multiple times would accumulate leaks, which is not representative of the simulated scenario. * MallocBench/MallocBench/Interpreter.cpp: (Interpreter::Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Support not deallocating all objects allocated during the recording, so we can do low memory warning memory use measurements, as above. * MallocBench/MallocBench/flickr.cpp: (benchmark_flickr_memory_warning): * MallocBench/MallocBench/main.cpp: (main): * MallocBench/MallocBench/reddit.cpp: (benchmark_reddit_memory_warning): * MallocBench/MallocBench/theverge.cpp: (benchmark_theverge_memory_warning): Adopt the API above. * MallocBench/run-malloc-benchmarks: I took a first pass at listing all available benchmarks here. Then I commented out the benchmarks that probably aren't reasonable to run by default. Canonical link: https://commits.webkit.org/149931@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-18 22:31:34 +00:00
print lpad(compareFunction.call(stats[0].result, stats[1].result), fieldSize)
Let's benchmark malloc https://bugs.webkit.org/show_bug.cgi?id=131118 Reviewed by Mark Hahnenberg. I want to replace fastMalloc with something faster (fasterMalloc?). I wrote these benchmarks to test / drive development. * MallocBench: Added. * MallocBench/MallocBench: Added. * MallocBench/MallocBench.xcodeproj: Added. * MallocBench/MallocBench.xcodeproj/project.pbxproj: Added. * MallocBench/MallocBench/Benchmark.cpp: Added. (allocateHeap): (deallocateHeap): (Benchmark::Benchmark): (Benchmark::printBenchmarks): (Benchmark::runOnce): (Benchmark::run): (Benchmark::printReport): (Benchmark::currentTimeMS): (Benchmark::currentMemoryBytes): * MallocBench/MallocBench/Benchmark.h: Added. (Benchmark::Memory::Memory): (Benchmark::Memory::operator-): (Benchmark::isValid): * MallocBench/MallocBench/CPUCount.cpp: Added. (cpuCount): * MallocBench/MallocBench/CPUCount.h: Added. * MallocBench/MallocBench/CommandLine.cpp: Added. (CommandLine::printUsage): * MallocBench/MallocBench/CommandLine.h: Added. (CommandLine::isValid): (CommandLine::benchmarkName): (CommandLine::isParallel): (CommandLine::heapSize): (CommandLine::measureHeap): * MallocBench/MallocBench/Interpreter.cpp: Added. (Interpreter::Interpreter): (Interpreter::~Interpreter): (Interpreter::run): * MallocBench/MallocBench/Interpreter.h: Added. * MallocBench/MallocBench/balloon.cpp: Added. (benchmark_balloon): * MallocBench/MallocBench/balloon.h: Added. * MallocBench/MallocBench/big.cpp: Added. (benchmark_big): * MallocBench/MallocBench/big.h: Added. * MallocBench/MallocBench/churn.cpp: Added. (HeapDouble::operator new): (HeapDouble::operator delete): (HeapDouble::HeapDouble): (HeapDouble::operator+=): (benchmark_churn): * MallocBench/MallocBench/churn.h: Added. * MallocBench/MallocBench/crash.ops: Added. * MallocBench/MallocBench/facebook.cpp: Added. (benchmark_facebook): * MallocBench/MallocBench/facebook.h: Added. * MallocBench/MallocBench/facebook.ops: Added. * MallocBench/MallocBench/fragment.cpp: Added. (validate): (benchmark_fragment): (benchmark_fragment_iterate): * MallocBench/MallocBench/fragment.h: Added. * MallocBench/MallocBench/list.cpp: Added. (benchmark_list_allocate): (benchmark_list_traverse): * MallocBench/MallocBench/list.h: Added. * MallocBench/MallocBench/main.cpp: Added. (main): * MallocBench/MallocBench/mbmalloc.cpp: Added. * MallocBench/MallocBench/mbmalloc.h: Added. * MallocBench/MallocBench/medium.cpp: Added. (benchmark_medium): * MallocBench/MallocBench/medium.h: Added. * MallocBench/MallocBench/message.cpp: Added. (benchmark_message_one): (benchmark_message_many): * MallocBench/MallocBench/message.h: Added. * MallocBench/MallocBench/realloc.cpp: Added. (benchmark_realloc): * MallocBench/MallocBench/realloc.h: Added. * MallocBench/MallocBench/tree.cpp: Added. (benchmark_tree_allocate): (benchmark_tree_traverse): (benchmark_tree_churn): * MallocBench/MallocBench/tree.h: Added. * MallocBench/run-malloc-benchmarks: Added. Canonical link: https://commits.webkit.org/149171@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-04-02 21:38:49 +00:00
end
print "\n"
}
print "\n"
printMean("<geometric mean>", results, method(:computeGeometricMean), compareFunction, suffix, fieldSize)
printMean("<arithmetic mean>", results, method(:computeArithmeticMean), compareFunction, suffix, fieldSize)
printMean("<harmonic mean>", results, method(:computeHarmonicMean), compareFunction, suffix, fieldSize)
print "\n"
end
fieldSize = ($benchmarks + ["<arithmetic mean>"]).collect {
| benchmark |
benchmark.size
}.max + 4
printHeader(dylibs, fieldSize)
printMetric("Execution Time", results.executionTime, method(:lowerIsFaster), "ms", fieldSize)
printMetric("Peak Memory", results.peakMemory, method(:lowerIsSmaller), "kB", fieldSize)
printMetric("Memory at End", results.memoryAtEnd, method(:lowerIsSmaller), "kB", fieldSize)
end
def main
begin
dylibs = parseOptions()
results = runBenchmarks(dylibs)
printResults(dylibs, results)
rescue => exception
puts
puts
puts exception
puts exception.backtrace
puts
end
end
main()