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

Issue 6173004: Simplify Join and speedup joining arrays of numbers. (Closed)

Created:
9 years, 11 months ago by sandholm
Modified:
9 years, 7 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Simplify Join and speedup joining arrays of numbers.

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 6

Patch Set 3 : '' #

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -13 lines) Patch
M src/array.js View 1 2 3 2 chunks +19 lines, -13 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
sandholm
9 years, 11 months ago (2011-01-10 10:35:45 UTC) #1
Lasse Reichstein
LGTM http://codereview.chromium.org/6173004/diff/2001/src/array.js File src/array.js (right): http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode121 src/array.js:121: return convert(e); How about checking against undefined after ...
9 years, 11 months ago (2011-01-10 10:51:44 UTC) #2
sandholm
9 years, 11 months ago (2011-01-10 11:40:52 UTC) #3
http://codereview.chromium.org/6173004/diff/2001/src/array.js
File src/array.js (right):

http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode121
src/array.js:121: return convert(e);
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
> How about checking against undefined after the IS_STRING test?
> Or does it happen so rarely that it doesn't matter anyway?

Doesn't matter.

http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode132
src/array.js:132: if (!(e == null)) {
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
> Use IS_NULL_OR_UNDEFINED (which reduces to this but better explains the type
> coercion).

I changed this back to IS_UNDEFINED after all.

http://codereview.chromium.org/6173004/diff/2001/src/array.js#newcode157
src/array.js:157: }
On 2011/01/10 10:51:44, Lasse Reichstein wrote:
> How about:
> if (IS_NUMBER(e)) { 
>   e = %_NumberToString(e);
> } else if (!IS_STRING(e)) {
>   e = convert(e);
> }
> elements[i] = e;
> 
> 
> or 
> 
> if (!IS_STRING(e)) {
>   if (IS_NUMBER(e)) {
>     e = %_NumberToString(e);
>   } else if (IS_NULL_OR_UNDEFINED(e)) {
>     e = ''
>   } else {
>     e = convert(e);
>   }
> }
> elements[i] = e;

I want the expected path (IS_NUMBER) to be as fast as possible. With these
rewrites I'll have two assignments instead of one in that case. I tried running
alternative one and it is a bit slower (1%).

Powered by Google App Engine
This is Rietveld 408576698