Title: [173529] trunk/PerformanceTests
Revision
173529
Author
[email protected]
Date
2014-09-11 12:33:47 -0700 (Thu, 11 Sep 2014)

Log Message

Some MallocBench refinements
https://bugs.webkit.org/show_bug.cgi?id=136750

Reviewed by Sam Weinig.

* MallocBench/MallocBench/Interpreter.cpp:
(Interpreter::run): Allow for null entries in the object list so that
we can test in modes that exclude large or small allocations.

* MallocBench/MallocBench/churn.cpp:
(benchmark_churn):
* MallocBench/MallocBench/flickr.cpp:
(benchmark_flickr):
* MallocBench/MallocBench/fragment.cpp:
(benchmark_fragment_iterate):
* MallocBench/MallocBench/list.cpp:
(benchmark_list_allocate):
* MallocBench/MallocBench/reddit.cpp:
(benchmark_reddit): Updated test runtimes to weight them more equally,
for the sake of arithmetic mean.

* MallocBench/MallocBench/stress.cpp:
(Object::Object):
(allocate):
(deallocate):
(benchmark_stress): Verify the contents of memory as we go. Also,
force scavenging each time through the loop to test the scavenging path.

* MallocBench/MallocBench/theverge.cpp:
(benchmark_theverge):
* MallocBench/MallocBench/tree.cpp:
(benchmark_tree_churn): Re-weighted, as above.

Modified Paths

Diff

Modified: trunk/PerformanceTests/ChangeLog (173528 => 173529)


--- trunk/PerformanceTests/ChangeLog	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/ChangeLog	2014-09-11 19:33:47 UTC (rev 173529)
@@ -1,3 +1,38 @@
+2014-09-11  Geoffrey Garen  <[email protected]>
+
+        Some MallocBench refinements
+        https://bugs.webkit.org/show_bug.cgi?id=136750
+
+        Reviewed by Sam Weinig.
+
+        * MallocBench/MallocBench/Interpreter.cpp:
+        (Interpreter::run): Allow for null entries in the object list so that
+        we can test in modes that exclude large or small allocations.
+
+        * MallocBench/MallocBench/churn.cpp:
+        (benchmark_churn):
+        * MallocBench/MallocBench/flickr.cpp:
+        (benchmark_flickr):
+        * MallocBench/MallocBench/fragment.cpp:
+        (benchmark_fragment_iterate):
+        * MallocBench/MallocBench/list.cpp:
+        (benchmark_list_allocate):
+        * MallocBench/MallocBench/reddit.cpp:
+        (benchmark_reddit): Updated test runtimes to weight them more equally,
+        for the sake of arithmetic mean.
+
+        * MallocBench/MallocBench/stress.cpp:
+        (Object::Object):
+        (allocate):
+        (deallocate):
+        (benchmark_stress): Verify the contents of memory as we go. Also,
+        force scavenging each time through the loop to test the scavenging path.
+
+        * MallocBench/MallocBench/theverge.cpp:
+        (benchmark_theverge):
+        * MallocBench/MallocBench/tree.cpp:
+        (benchmark_tree_churn): Re-weighted, as above.
+
 2014-09-08  Myles C. Maxfield  <[email protected]>
 
         PerformanceTests/SVG/SVG-Text.html has unparsable output

Modified: trunk/PerformanceTests/MallocBench/MallocBench/Interpreter.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/Interpreter.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/Interpreter.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -101,13 +101,15 @@
                 break;
             }
             case op_free: {
-                assert(m_objects[op.slot].object);
+                if (!m_objects[op.slot].object)
+                    continue;
                 mbfree(m_objects[op.slot].object, m_objects[op.slot].size);
                 m_objects[op.slot] = { 0, 0 };
                 break;
             }
             case op_realloc: {
-                assert(m_objects[op.slot].object);
+                if (!m_objects[op.slot].object)
+                    continue;
                 m_objects[op.slot] = { mbrealloc(m_objects[op.slot].object, m_objects[op.slot].size, op.size), op.size };
                 break;
             }

Modified: trunk/PerformanceTests/MallocBench/MallocBench/churn.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/churn.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/churn.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -41,7 +41,7 @@
 
 void benchmark_churn(bool isParallel)
 {
-    size_t times = 10000000;
+    size_t times = 7000000;
     if (isParallel)
         times /= cpuCount();
 

Modified: trunk/PerformanceTests/MallocBench/MallocBench/flickr.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/flickr.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/flickr.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -44,7 +44,7 @@
 
 void benchmark_flickr(bool isParallel)
 {
-    size_t times = 1;
+    size_t times = 3;
 
     Interpreter interpreter("flickr.ops");
     for (size_t i = 0; i < times; ++i)

Modified: trunk/PerformanceTests/MallocBench/MallocBench/fragment.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/fragment.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/fragment.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -110,7 +110,7 @@
 void benchmark_fragment_iterate(bool isParallel)
 {
     size_t nodeCount = 512 * 1024;
-    size_t times = 32;
+    size_t times = 20;
     if (isParallel)
         nodeCount /= cpuCount();
     size_t replaceCount = nodeCount / 4;

Modified: trunk/PerformanceTests/MallocBench/MallocBench/list.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/list.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/list.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -99,7 +99,7 @@
 void benchmark_list_allocate(bool isParallel)
 {
     Node* head = 0;
-    size_t times = 96;
+    size_t times = 70;
     size_t nodes = 32 * 1024;
     if (isParallel) {
         nodes /= cpuCount();

Modified: trunk/PerformanceTests/MallocBench/MallocBench/reddit.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/reddit.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/reddit.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -44,7 +44,7 @@
 
 void benchmark_reddit(bool isParallel)
 {
-    size_t times = 1;
+    size_t times = 6;
 
     Interpreter interpreter("reddit.ops");
     for (size_t i = 0; i < times; ++i)

Modified: trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/stress.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -39,14 +39,16 @@
 static const size_t MB = kB * kB;
 
 struct Object {
-    Object(void* pointer, size_t size)
+    Object(void* pointer, size_t size, long uuid)
         : pointer(pointer)
         , size(size)
+        , uuid(uuid)
     {
     }
 
     void* pointer;
     size_t size;
+    long uuid;
 };
 
 class SizeStream {
@@ -100,6 +102,24 @@
     size_t m_count;
 };
 
+Object allocate(size_t size)
+{
+    Object object(mbmalloc(size), size, random());
+    for (size_t i = 0; i < size / sizeof(long); ++i)
+        (static_cast<long*>(object.pointer))[i] = object.uuid;
+    return object;
+}
+
+void deallocate(const Object& object)
+{
+    for (size_t i = 0; i < object.size / sizeof(long); ++i) {
+        if ((static_cast<long*>(object.pointer))[i] != object.uuid)
+            abort();
+    }
+
+    mbfree(object.pointer, object.size);
+}
+
 void benchmark_stress(bool isParallel)
 {
     const size_t heapSize = 100 * MB;
@@ -112,18 +132,17 @@
     
     SizeStream sizeStream;
     
-    size_t lastSize = 0;
-    for (size_t remaining = heapSize; remaining; remaining -= std::min(remaining, lastSize)) {
-        lastSize = sizeStream.next();
-        Object object(mbmalloc(lastSize), lastSize);
-        objects.push_back(object);
+    size_t size = 0;
+    for (size_t remaining = heapSize; remaining; remaining -= std::min(remaining, size)) {
+        size = sizeStream.next();
+        objects.push_back(allocate(size));
     }
     
     for (size_t i = 0; i < churnCount; ++i) {
         std::vector<Object> objectsToFree;
-        for (size_t remaining = churnSize; remaining; remaining -= std::min(remaining, lastSize)) {
-            lastSize = sizeStream.next();
-            Object object(mbmalloc(lastSize), lastSize);
+        for (size_t remaining = churnSize; remaining; remaining -= std::min(remaining, size)) {
+            size = sizeStream.next();
+            Object object = allocate(size);
 
             size_t index = random() % objects.size();
             objectsToFree.push_back(objects[index]);
@@ -131,7 +150,9 @@
         }
 
         for (auto& object : objectsToFree)
-            mbfree(object.pointer, object.size);
+            deallocate(object);
+        
+        mbscavenge();
     }
     
     for (auto& object : objects)

Modified: trunk/PerformanceTests/MallocBench/MallocBench/theverge.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/theverge.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/theverge.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -44,7 +44,7 @@
 
 void benchmark_theverge(bool isParallel)
 {
-    size_t times = 1;
+    size_t times = 3;
 
     Interpreter interpreter("theverge.ops");
     for (size_t i = 0; i < times; ++i)

Modified: trunk/PerformanceTests/MallocBench/MallocBench/tree.cpp (173528 => 173529)


--- trunk/PerformanceTests/MallocBench/MallocBench/tree.cpp	2014-09-11 19:26:16 UTC (rev 173528)
+++ trunk/PerformanceTests/MallocBench/MallocBench/tree.cpp	2014-09-11 19:33:47 UTC (rev 173529)
@@ -207,7 +207,7 @@
 
 void benchmark_tree_churn(bool isParallel)
 {
-    size_t times = 160;
+    size_t times = 130;
     size_t depth = 15;
     if (isParallel) {
         times *= 4;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to