<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 - Set existence with numeric values slower than numeric object property existence"
   href="https://bugs.webkit.org/show_bug.cgi?id=151233">151233</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Set existence with numeric values slower than numeric object property existence
          </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>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>joepeck&#64;webkit.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>keith_miller&#64;apple.com, sbarati&#64;apple.com, utatane.tea&#64;gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=265448" name="attach_265448" title="[TEST] Set Existence Benchmark">attachment 265448</a> <a href="attachment.cgi?id=265448&amp;action=edit" title="[TEST] Set Existence Benchmark">[details]</a></span>
[TEST] Set Existence Benchmark

* SUMMARY
Set existence with numeric values slower than numeric object property existence.

In Web Inspector we were converting a bunch of uses of &quot;Object as Set&quot; and &quot;Object as Map&quot; to Set/Map objects. I wrote a small benchmark to compare possible performance differences. Existence checks for large dense Sets with primitives is worse than existence checks in large dense Objects.

    object[number]    - 17ms
    number in object  - 84ms
    set.has(number)   - 622ms

For numeric keys object was significantly faster than Set.
For other key types the effect was not as large.

See attached test case.

* NOTES
- Not sure how realistic the test is for real world code. Especially given Set's major advantage is non-primitive keys.</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>