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

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat May 25 17:14:41 PDT 2013


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


Filip Pizlo <fpizlo at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fpizlo at apple.com




--- Comment #3 from Filip Pizlo <fpizlo at apple.com>  2013-05-25 17:13:10 PST ---
(In reply to comment #0)
> 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;

Lol.  This is just us being dumb.  We have separate implementations of == and === and we added more optimizations to one and not the other, I guess.

-- 
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