<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Pathological performance on first execution of a function called with mismatched argument count"
href="https://bugs.webkit.org/show_bug.cgi?id=155551">155551</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Pathological performance on first execution of a function called with mismatched argument count
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr>
<tr>
<th>Product</th>
<td>WebKit
</td>
</tr>
<tr>
<th>Version</th>
<td>WebKit Nightly Build
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>OS</th>
<td>Unspecified
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Keywords</th>
<td>NeedsRadar
</td>
</tr>
<tr>
<th>Severity</th>
<td>Normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P2
</td>
</tr>
<tr>
<th>Component</th>
<td>JavaScriptCore
</td>
</tr>
<tr>
<th>Assignee</th>
<td>webkit-unassigned@lists.webkit.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>oliver@apple.com
</td>
</tr>
<tr>
<th>CC</th>
<td>fpizlo@apple.com, mark.lam@apple.com, msaboff@apple.com, sbarati@apple.com
</td>
</tr></table>
<p>
<div>
<pre>So, i have a case of strange performance if i don’t pass an argument
function f(j) { for (var i = 0 ; i < 10000000; i++) j = (j ? j * i : 1) ^ (i & j); }; var start = new Date; f(1); var end = new Date; print("1st: " + (end - start) + "ms"); var start = new Date; f(1); var end = new Date; print("2nd: " + (end - start) + "ms")
1st: 245ms
2nd: 223ms
If we do it again, without passing a parameter we get:
function f(j) { for (var i = 0 ; i < 10000000; i++) j = (j ? j * i : 1) ^ (i & j); };
var start = new Date; f(); var end = new Date; print("1st: " + (end - start) + "ms");
var start = new Date; f(); var end = new Date; print("2nd: " + (end - start) + "ms")
1st: 11919ms
2nd: 29ms
I tried a couple of permutations, and in general it appears the first run through without passing a parameter never tiers up.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>