[Webkit-unassigned] [Bug 116764] New: == and === should have more comparable performance when both sides are strings

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat May 25 11:59:27 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=116764

           Summary: == and === should have more comparable performance
                    when both sides are strings
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: joepeck at webkit.org
                CC: benjamin at webkit.org,
                    webkit-bug-importer at group.apple.com


I stumbled across a micro-benchmark today comparing == and === between strings. Chrome and Firefox have nearly equivalent performance for each, while the WebKit Nightly showed `===` being noticeably better than `==`. It seems we could improve `==` in such cases to match `===`:
<http://jsperf.com/comparison-of-comparisons>

WebKit Nightly r150579 / Safari 6.0.4:
==: 260,969,330
===: 420,311,703
difference: ~61% more

Chrome Canary 29.0.1518.2:
==: 367,785,800
===: 375,298,004
difference: ~2% more

Firefox Nightly 23.0a1 (2013-04-28):
==: 776,644,421
===: 777,027,376
difference: ~0% more


JSBench Test

Setup:
<script>
  Benchmark.prototype.setup = function() {
    var a = 'hello';
    var b = 'world';
    var c = 'hello';
  };
</script>

Test1: "Identity"
a === b;
a === c;

Test2: "Equality"
a == b;
a == c;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list