Title: [200060] trunk/PerformanceTests
Revision
200060
Author
[email protected]
Date
2016-04-25 16:50:25 -0700 (Mon, 25 Apr 2016)

Log Message

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.

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (200059 => 200060)


--- trunk/PerformanceTests/ChangeLog	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/ChangeLog	2016-04-25 23:50:25 UTC (rev 200060)
@@ -1,3 +1,45 @@
+2016-04-25  Geoffrey Garen  <[email protected]>
+
+        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  <[email protected]>
 
         Add a content animation test that uses SVG animation.

Modified: trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -201,8 +201,8 @@
     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 @@
         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;
 }

Modified: trunk/PerformanceTests/MallocBench/MallocBench/CommandLine.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/CommandLine.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/CommandLine.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -47,7 +47,7 @@
     , m_useThreadID(false)
     , m_warmUp(true)
     , m_heapSize(0)
-    , m_runs(4)
+    , m_runs(8)
 {
     int optionIndex = 0;
     int ch;

Modified: trunk/PerformanceTests/MallocBench/MallocBench/alloc_free.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/alloc_free.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/alloc_free.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -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);
 

Modified: trunk/PerformanceTests/MallocBench/MallocBench/big.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/big.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/big.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -44,8 +44,8 @@
     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();
 

Modified: trunk/PerformanceTests/MallocBench/MallocBench/medium.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/medium.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/medium.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -44,7 +44,7 @@
     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();

Modified: trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -124,7 +124,7 @@
 {
     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.
 

Modified: trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp	2016-04-25 23:50:25 UTC (rev 200060)
@@ -145,7 +145,7 @@
     
     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 @@
             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();

Modified: trunk/PerformanceTests/MallocBench/run-malloc-benchmarks (200059 => 200060)


--- trunk/PerformanceTests/MallocBench/run-malloc-benchmarks	2016-04-25 23:41:51 UTC (rev 200059)
+++ trunk/PerformanceTests/MallocBench/run-malloc-benchmarks	2016-04-25 23:50:25 UTC (rev 200060)
@@ -6,7 +6,7 @@
 $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 @@
     # "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,6 +213,8 @@
 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 {
@@ -205,6 +222,10 @@
         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 @@
             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"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to