<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198546] trunk/PerformanceTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198546">198546</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-03-22 12:39:38 -0700 (Tue, 22 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>MallocBench: consolidate regression testing for aligned allocation
https://bugs.webkit.org/show_bug.cgi?id=155762

Reviewed by Michael Saboff.

* MallocBench/MallocBench.xcodeproj/project.pbxproj:
* MallocBench/MallocBench/Benchmark.cpp:
* MallocBench/MallocBench/memalign.cpp: Removed.
* MallocBench/MallocBench/memalign.h: Removed. The stress_aligned test
covers this and much more.

* MallocBench/MallocBench/stress_aligned.cpp:
(benchmark_stress_aligned): Include specific tests for extreme sizes
and alignments.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
<li><a href="#trunkPerformanceTestsMallocBenchMallocBenchBenchmarkcpp">trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp</a></li>
<li><a href="#trunkPerformanceTestsMallocBenchMallocBenchstress_alignedcpp">trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp</a></li>
<li><a href="#trunkPerformanceTestsMallocBenchMallocBenchxcodeprojprojectpbxproj">trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsMallocBenchMallocBenchmemaligncpp">trunk/PerformanceTests/MallocBench/MallocBench/memalign.cpp</a></li>
<li><a href="#trunkPerformanceTestsMallocBenchMallocBenchmemalignh">trunk/PerformanceTests/MallocBench/MallocBench/memalign.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/ChangeLog        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-03-22  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        MallocBench: consolidate regression testing for aligned allocation
+        https://bugs.webkit.org/show_bug.cgi?id=155762
+
+        Reviewed by Michael Saboff.
+
+        * MallocBench/MallocBench.xcodeproj/project.pbxproj:
+        * MallocBench/MallocBench/Benchmark.cpp:
+        * MallocBench/MallocBench/memalign.cpp: Removed.
+        * MallocBench/MallocBench/memalign.h: Removed. The stress_aligned test
+        covers this and much more.
+
+        * MallocBench/MallocBench/stress_aligned.cpp:
+        (benchmark_stress_aligned): Include specific tests for extreme sizes
+        and alignments.
+
</ins><span class="cx"> 2016-03-21  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update benchmark tests
</span></span></pre></div>
<a id="trunkPerformanceTestsMallocBenchMallocBenchBenchmarkcpp"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/MallocBench/MallocBench/Benchmark.cpp        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -34,7 +34,6 @@
</span><span class="cx"> #include &quot;fragment.h&quot;
</span><span class="cx"> #include &quot;list.h&quot;
</span><span class="cx"> #include &quot;medium.h&quot;
</span><del>-#include &quot;memalign.h&quot;
</del><span class="cx"> #include &quot;message.h&quot;
</span><span class="cx"> #include &quot;nimlang.h&quot;
</span><span class="cx"> #include &quot;reddit.h&quot;
</span><span class="lines">@@ -75,7 +74,6 @@
</span><span class="cx">     { &quot;list_allocate&quot;, benchmark_list_allocate },
</span><span class="cx">     { &quot;list_traverse&quot;, benchmark_list_traverse },
</span><span class="cx">     { &quot;medium&quot;, benchmark_medium },
</span><del>-    { &quot;memalign&quot;, benchmark_memalign },
</del><span class="cx">     { &quot;message_many&quot;, benchmark_message_many },
</span><span class="cx">     { &quot;message_one&quot;, benchmark_message_one },
</span><span class="cx">     { &quot;nimlang&quot;, benchmark_nimlang },
</span></span></pre></div>
<a id="trunkPerformanceTestsMallocBenchMallocBenchmemaligncpp"></a>
<div class="delfile"><h4>Deleted: trunk/PerformanceTests/MallocBench/MallocBench/memalign.cpp (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/MallocBench/MallocBench/memalign.cpp        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/MallocBench/MallocBench/memalign.cpp        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#include &lt;assert.h&gt;
-#include &quot;memalign.h&quot;
-#include &lt;memory&gt;
-#include &lt;stddef.h&gt;
-#include &quot;CommandLine.h&quot;
-
-#include &quot;mbmalloc.h&quot;
-
-void test(size_t alignment, size_t size)
-{
-    void* result = mbmemalign(alignment, size);
-
-    assert(result);
-    assert(!((uintptr_t)result &amp; (alignment - 1)));
-    
-    mbfree(result, size);
-}
-
-void benchmark_memalign(CommandLine&amp;)
-{
-    for (size_t alignment = 2; alignment &lt; 4096; alignment *= 2) {
-        for (size_t size = 0; size &lt; 4096; ++size)
-            test(alignment, size);
-    }
-
-    test(1 * 1024 * 1024, 8);
-    test(8 * 1024 * 1024, 8);
-    test(32 * 1024 * 1024, 8);
-    test(64 * 1024 * 1024, 8);
-    test(1 * 1024 * 1024, 8 * 1024 * 1024);
-    test(1 * 1024 * 1024, 16 * 1024 * 1024);
-}
</del></span></pre></div>
<a id="trunkPerformanceTestsMallocBenchMallocBenchmemalignh"></a>
<div class="delfile"><h4>Deleted: trunk/PerformanceTests/MallocBench/MallocBench/memalign.h (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/MallocBench/MallocBench/memalign.h        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/MallocBench/MallocBench/memalign.h        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -1,34 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#ifndef memalign_h
-#define memalign_h
-
-#include &quot;CommandLine.h&quot;
-
-void benchmark_memalign(CommandLine&amp;);
-
-#endif // memalign_h
-
</del></span></pre></div>
<a id="trunkPerformanceTestsMallocBenchMallocBenchstress_alignedcpp"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/MallocBench/MallocBench/stress_aligned.cpp        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -145,6 +145,24 @@
</span><span class="cx">     
</span><span class="cx">     srandom(1); // For consistency between runs.
</span><span class="cx"> 
</span><ins>+    size_t limit = 0x000007fffffffffful;
+    
+    for (size_t size = 0; size &lt; limit; size = std::max(size, sizeof(void*)) * 2) {
+        for (size_t alignment = sizeof(void*); alignment &lt; limit; alignment *= 2) {
+            void* object = mbmemalign(alignment, size);
+            if (reinterpret_cast&lt;uintptr_t&gt;(object) &amp; (alignment - 1))
+                abort();
+            mbfree(object, size);
+        }
+
+        for (size_t alignment = sizeof(void*); alignment &lt; limit / 4; alignment *= 2) {
+            void* object = mbmemalign(alignment, size + 128);
+            if (reinterpret_cast&lt;uintptr_t&gt;(object) &amp; (alignment - 1))
+                abort();
+            mbfree(object, size + 128);
+        }
+    }
+
</ins><span class="cx">     std::vector&lt;Object&gt; objects;
</span><span class="cx">     
</span><span class="cx">     SizeStream sizeStream;
</span></span></pre></div>
<a id="trunkPerformanceTestsMallocBenchMallocBenchxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj (198545 => 198546)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj        2016-03-22 19:39:12 UTC (rev 198545)
+++ trunk/PerformanceTests/MallocBench/MallocBench.xcodeproj/project.pbxproj        2016-03-22 19:39:38 UTC (rev 198546)
</span><span class="lines">@@ -36,7 +36,6 @@
</span><span class="cx">                 14CC393F18EA8184004AFE34 /* mbmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CC391C18EA6759004AFE34 /* mbmalloc.cpp */; };
</span><span class="cx">                 14CE4A6017BD355800288DAA /* big.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CE4A5E17BD355800288DAA /* big.cpp */; };
</span><span class="cx">                 14D0BFF31A6F4D3B00109F31 /* stress_aligned.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14D0BFF11A6F4D3B00109F31 /* stress_aligned.cpp */; };
</span><del>-                14D6322E1A69BE0B00A8F84F /* memalign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14D6322C1A69BE0B00A8F84F /* memalign.cpp */; };
</del><span class="cx">                 14E11932177ECC8B003A8D15 /* CPUCount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14E11930177ECC8B003A8D15 /* CPUCount.cpp */; };
</span><span class="cx">                 14FCA36119A7C917001CFDA9 /* stress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14FCA35F19A7C917001CFDA9 /* stress.cpp */; };
</span><span class="cx">                 65E401A61C657A87003C6E9C /* nimlang.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65E401A41C657A87003C6E9C /* nimlang.cpp */; };
</span><span class="lines">@@ -112,8 +111,6 @@
</span><span class="cx">                 14CE4A5F17BD355800288DAA /* big.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = big.h; path = MallocBench/big.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 14D0BFF11A6F4D3B00109F31 /* stress_aligned.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = stress_aligned.cpp; path = MallocBench/stress_aligned.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 14D0BFF21A6F4D3B00109F31 /* stress_aligned.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stress_aligned.h; path = MallocBench/stress_aligned.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                14D6322C1A69BE0B00A8F84F /* memalign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = memalign.cpp; path = MallocBench/memalign.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                14D6322D1A69BE0B00A8F84F /* memalign.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = memalign.h; path = MallocBench/memalign.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 14E11930177ECC8B003A8D15 /* CPUCount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CPUCount.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 14E11931177ECC8B003A8D15 /* CPUCount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPUCount.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 14E11934177F5219003A8D15 /* mbmalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mbmalloc.h; path = MallocBench/mbmalloc.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -222,8 +219,6 @@
</span><span class="cx">                                 14976EC7177E3649006B819A /* list.h */,
</span><span class="cx">                                 1451FAEB18B14B7100DB6D47 /* medium.cpp */,
</span><span class="cx">                                 1451FAEC18B14B7100DB6D47 /* medium.h */,
</span><del>-                                14D6322C1A69BE0B00A8F84F /* memalign.cpp */,
-                                14D6322D1A69BE0B00A8F84F /* memalign.h */,
</del><span class="cx">                                 1444AE94177E8DF200F8030A /* message.cpp */,
</span><span class="cx">                                 1444AE95177E8DF200F8030A /* message.h */,
</span><span class="cx">                                 14105E8018E13EEC003A106E /* realloc.cpp */,
</span><span class="lines">@@ -346,7 +341,6 @@
</span><span class="cx">                                 14C5009318403DA0007A531D /* Interpreter.cpp in Sources */,
</span><span class="cx">                                 1447AE9118FB584200B3D7FF /* reddit.cpp in Sources */,
</span><span class="cx">                                 14E11932177ECC8B003A8D15 /* CPUCount.cpp in Sources */,
</span><del>-                                14D6322E1A69BE0B00A8F84F /* memalign.cpp in Sources */,
</del><span class="cx">                                 1444AE93177E79BB00F8030A /* fragment.cpp in Sources */,
</span><span class="cx">                                 14105E8218E13EEC003A106E /* realloc.cpp in Sources */,
</span><span class="cx">                                 14105E7F18DF7D73003A106E /* balloon.cpp in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>