Skip to content
Permalink
Browse files
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
  • Loading branch information
geoffreygaren committed Apr 25, 2016
1 parent b5b5350 commit 59ece2a82c1838cb9f9fa77854eb7e94fed4fcd2
@@ -1,3 +1,45 @@
2016-04-25 Geoffrey Garen <ggaren@apple.com>

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.

2016-04-25 Simon Fraser <simon.fraser@apple.com>

Add a content animation test that uses SVG animation.
@@ -201,8 +201,8 @@ void Benchmark::printReport()
size_t kB = 1024;

cout << "Time: \t" << m_elapsedTime << "ms" << endl;
cout << "Memory: \t" << m_memory.resident / kB << "kB" << endl;
cout << "Peak Memory:\t" << m_memory.residentMax / kB << "kB" << endl;
cout << "Memory at End: \t" << m_memory.resident / kB << "kB" << endl;
}

double Benchmark::currentTimeMS()
@@ -223,7 +223,7 @@ Benchmark::Memory Benchmark::currentMemoryBytes()
exit(1);
}

memory.resident = vm_info.internal - vm_info.purgeable_volatile_pmap;
memory.resident = vm_info.internal + vm_info.compressed - vm_info.purgeable_volatile_pmap;
memory.residentMax = vm_info.resident_size_peak;
return memory;
}
@@ -47,7 +47,7 @@ CommandLine::CommandLine(int argc, char** argv)
, m_useThreadID(false)
, m_warmUp(true)
, m_heapSize(0)
, m_runs(4)
, m_runs(8)
{
int optionIndex = 0;
int ch;
@@ -30,15 +30,10 @@

void benchmark_alloc_free(CommandLine&)
{
size_t loops = 1000000;
size_t loops = 40000;

size_t allocSize = 1030;
size_t allocSize = 128 * 1024;

char* dummy1 = (char*)mbmalloc(allocSize);
char* dummy2 = (char*)mbmalloc(allocSize);
dummy2[0] = 'a';
mbfree(dummy1, allocSize);

while (--loops) {
char* object = (char*)mbmalloc(allocSize);

@@ -44,8 +44,8 @@ void benchmark_big(CommandLine& commandLine)
size_t times = 1;

size_t vmSize = 1ul * 1024 * 1024 * 1024;
size_t objectSizeMin = 4 * 1024;
size_t objectSizeMax = 64 * 1024;
size_t objectSizeMin = 8 * 1024;
size_t objectSizeMax = 128 * 1024;
if (commandLine.isParallel())
vmSize /= cpuCount();

@@ -44,7 +44,7 @@ void benchmark_medium(CommandLine& commandLine)
size_t times = 1;

size_t vmSize = 1ul * 1024 * 1024 * 1024;
size_t objectSizeMin = 2 * 1024;
size_t objectSizeMin = 1 * 1024;
size_t objectSizeMax = 8 * 1024;
if (commandLine.isParallel())
vmSize /= cpuCount();
@@ -124,7 +124,7 @@ void benchmark_stress(CommandLine&)
{
const size_t heapSize = 100 * MB;
const size_t churnSize = .05 * heapSize;
const size_t churnCount = 1000;
const size_t churnCount = 100;

srandom(1); // For consistency between runs.

@@ -145,7 +145,7 @@ void benchmark_stress_aligned(CommandLine&)

srandom(1); // For consistency between runs.

size_t limit = 0x000007fffffffffful;
size_t limit = 0x00001ffffffffffful;

for (size_t size = 0; size < limit; size = std::max(size, sizeof(void*)) * 2) {
for (size_t alignment = sizeof(void*); alignment < limit; alignment *= 2) {
@@ -155,7 +155,7 @@ void benchmark_stress_aligned(CommandLine&)
mbfree(object, size);
}

for (size_t alignment = sizeof(void*); alignment < limit / 4; alignment *= 2) {
for (size_t alignment = sizeof(void*); alignment < limit; alignment *= 2) {
void* object = mbmemalign(alignment, size + 128);
if (reinterpret_cast<uintptr_t>(object) & (alignment - 1))
abort();
@@ -6,7 +6,7 @@ require 'pathname'
$binDir = "#{File.expand_path(File.dirname(__FILE__))}"
$productDir = `perl -e 'use lib \"#{$binDir}/../../Tools/Scripts\"; use webkitdirs; print productDir()'`

$benchmarks = [
$benchmarks_all = [
# Single-threaded benchmarks.
"churn",
"list_allocate",
@@ -54,6 +54,21 @@ $benchmarks = [
# "balloon"
]

$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
$heap = 0

def usage
@@ -198,13 +213,19 @@ end
def parseOptions
GetoptLong.new(
['--benchmark', GetoptLong::REQUIRED_ARGUMENT],
['--memory', GetoptLong::NO_ARGUMENT],
['--memory_warning', GetoptLong::NO_ARGUMENT],
['--heap', GetoptLong::REQUIRED_ARGUMENT],
['--help', GetoptLong::NO_ARGUMENT],
).each {
| opt, arg |
case opt
when '--benchmark'
$benchmarks = [ arg ]
when '--memory'
$benchmarks = $benchmarks_memory
when '--memory_warning'
$benchmarks = $benchmarks_memory_warning
when '--heap'
$heap = arg
when '--help'
@@ -274,8 +295,8 @@ def runBenchmarks(dylibs)
splitOutput = output.split("\n")

executionTime[-1].push(TimeStat.new(benchmark, splitOutput[1]))
peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[3] : "0"))
memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[2] : "0"))
peakMemory[-1].push(PeakMemoryStat.new(benchmark, splitOutput.length > 3 ? splitOutput[2] : "0"))
memoryAtEnd[-1].push(MemoryStat.new(benchmark, splitOutput.length > 2 ? splitOutput[3] : "0"))
}
}
$stderr.print "\r \n"

0 comments on commit 59ece2a

Please sign in to comment.