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

Issue 6072004: Avoid decoding overhead when allocating ascii strings.... (Closed)

Created:
10 years ago by Mads Ager (chromium)
Modified:
9 years, 7 months ago
Reviewers:
Lasse Reichstein
CC:
v8-dev
Visibility:
Public.

Description

Avoid decoding overhead when allocating ascii strings. The assumption is that most utf8 strings allocated are actually ascii and that if they are not we will encounter a non-ascii char pretty quickly. Committed: http://code.google.com/p/v8/source/detail?r=6099

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -10 lines) Patch
M src/heap.h View 1 chunk +4 lines, -1 line 0 comments Download
M src/heap.cc View 2 chunks +3 lines, -9 lines 0 comments Download
M src/heap-inl.h View 1 chunk +15 lines, -0 lines 4 comments Download

Messages

Total messages: 3 (0 generated)
Mads Ager (chromium)
10 years ago (2010-12-21 12:30:16 UTC) #1
Lasse Reichstein
Good fix. LGTM. http://codereview.chromium.org/6072004/diff/1/src/heap-inl.h File src/heap-inl.h (right): http://codereview.chromium.org/6072004/diff/1/src/heap-inl.h#newcode45 src/heap-inl.h:45: // Check for ascii first since ...
10 years ago (2010-12-21 12:48:12 UTC) #2
Mads Ager (chromium)
10 years ago (2010-12-21 12:55:52 UTC) #3
Thanks!

http://codereview.chromium.org/6072004/diff/1/src/heap-inl.h
File src/heap-inl.h (right):

http://codereview.chromium.org/6072004/diff/1/src/heap-inl.h#newcode45
src/heap-inl.h:45: // Check for ascii first since this is the common case.
On 2010/12/21 12:48:12, Lasse Reichstein wrote:
> ASCII is an acronym, even though we might not respect that in function names.
> More instances below.

Done.

http://codereview.chromium.org/6072004/diff/1/src/heap-inl.h#newcode47
src/heap-inl.h:47: if (static_cast<uc16>(str[i]) > String::kMaxAsciiCharCode) {
On 2010/12/21 12:48:12, Lasse Reichstein wrote:
> Just cast to uint8_t, and compare to String:kMaxAsciiCharCodeU. It will allow
> the compiler to just check the sign bit.

Done.

Powered by Google App Engine
This is Rietveld 408576698