Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(240)

Issue 8511023: Use strict when possible. Don't even try to cache the hashcode for strings. (Closed)

Created:
9 years, 1 month ago by floitsch
Modified:
9 years, 1 month ago
Reviewers:
jgw, sra1
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Use strict when possible. Don't even try to cache the hashcode for strings. Committed: https://code.google.com/p/dart/source/detail?r=1745

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+88 lines, -23 lines) Patch
M compiler/lib/implementation/number.js View 3 chunks +57 lines, -10 lines 0 comments Download
M compiler/lib/implementation/string.js View 6 chunks +31 lines, -13 lines 4 comments Download

Messages

Total messages: 5 (0 generated)
floitsch
'use strict'; whenever possible. Compliant browsers don't need to box the primitive types anymore which ...
9 years, 1 month ago (2011-11-09 21:11:26 UTC) #1
floitsch
ping
9 years, 1 month ago (2011-11-18 14:17:41 UTC) #2
jgw
On 2011/11/18 14:17:41, floitsch wrote: > ping Whoops, sorry I missed this. I don't see ...
9 years, 1 month ago (2011-11-22 14:25:33 UTC) #3
sra1
http://codereview.chromium.org/8511023/diff/1/compiler/lib/implementation/string.js File compiler/lib/implementation/string.js (right): http://codereview.chromium.org/8511023/diff/1/compiler/lib/implementation/string.js#newcode96 compiler/lib/implementation/string.js:96: "use strict"; What is the benefit of "use strict" ...
9 years, 1 month ago (2011-11-22 18:13:39 UTC) #4
floitsch
9 years, 1 month ago (2011-11-23 09:21:54 UTC) #5
http://codereview.chromium.org/8511023/diff/1/compiler/lib/implementation/str...
File compiler/lib/implementation/string.js (right):

http://codereview.chromium.org/8511023/diff/1/compiler/lib/implementation/str...
compiler/lib/implementation/string.js:96: "use strict";
On 2011/11/22 18:13:39, sra1 wrote:
> What is the benefit of "use strict" in this and the other functions?  Does it
> make a measurable performance improvement?
"use strict" doesn't wrap the object. So (3).hashCode() will not go through the
boxing.
Iirc we saw a *5 improvement on the raytracer (that some external user submitted
to the mailing list a long time ago).

http://codereview.chromium.org/8511023/diff/1/compiler/lib/implementation/str...
compiler/lib/implementation/string.js:101: hash += hash << 10;
On 2011/11/22 18:13:39, sra1 wrote:
> The result of += can be outside the 32-bit range of << and ^= leading to
boxing.
>  I think this loop needs to be carefully rewritten so that the common browsers
> all are fast.
> 
> I'm wondering where this hash function originated, and if we intend to define
> the hash code of a string.

Given that we can't store the hash we should rethink our hashing strategy
anyways.
Maybe open a bug?

Powered by Google App Engine
This is Rietveld 408576698