<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&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>oliver&#64;apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>fpizlo&#64;apple.com, mark.lam&#64;apple.com, msaboff&#64;apple.com, sbarati&#64;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 &lt; 10000000; i++) j = (j ?  j * i : 1) ^ (i &amp; j); }; var start = new Date; f(1); var end = new Date; print(&quot;1st: &quot; + (end - start) + &quot;ms&quot;); var start = new Date; f(1); var end = new Date; print(&quot;2nd: &quot; + (end - start) + &quot;ms&quot;)
1st: 245ms
2nd: 223ms

If we do it again, without passing a parameter we get:
function f(j) { for (var i = 0 ; i &lt; 10000000; i++) j = (j ?  j * i : 1) ^ (i &amp; j); }; 
var start = new Date; f(); var end = new Date; print(&quot;1st: &quot; + (end - start) + &quot;ms&quot;); 
var start = new Date; f(); var end = new Date; print(&quot;2nd: &quot; + (end - start) + &quot;ms&quot;)

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>