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

Issue 9801007: Improve JSONReader performance by up to 55% by using std::string instead of wstring. (Closed)

Created:
8 years, 9 months ago by Robert Sesek
Modified:
8 years, 9 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, Mark Mentovai
Visibility:
Public.

Description

Improve JSONReader performance by up to 55% by using std::string instead of wstring. Before this change, JSONReader would: 1. Take std::string input 2. Convert it to wstring 3. Parse 4. Decode strings for the object representation, converting wstring to string16 5. Create a base::Value with a string16, which internally converts back to std::string After this change, JSONReader does: 1. Take std::string input 2. Parse 3. Create a base::Value with a std::string BUG=111581 TEST=Covered by unittests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=128678

Patch Set 1 #

Patch Set 2 : uint32 to make win happy #

Patch Set 3 : Pass Windows tests #

Total comments: 6

Patch Set 4 : Address comments #

Total comments: 2

Patch Set 5 : Use HexStringToInt #

Total comments: 4

Patch Set 6 : Safety for \x #

Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -53 lines) Patch
M base/json/json_reader.h View 1 2 3 4 4 chunks +21 lines, -7 lines 0 comments Download
M base/json/json_reader.cc View 1 2 3 4 5 15 chunks +107 lines, -46 lines 0 comments Download
M base/json/json_reader_unittest.cc View 1 2 3 4 1 chunk +32 lines, -0 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Robert Sesek
willchan: review please jshin: I was told you have familiarity with ICU and unicode. Would ...
8 years, 9 months ago (2012-03-21 19:23:53 UTC) #1
willchan no longer on Chromium
Wow, I know very little about std::string vs wsting vs string16, not to mention unicode/icu. ...
8 years, 9 months ago (2012-03-22 00:51:10 UTC) #2
brettw
https://chromiumcodereview.appspot.com/9801007/diff/14001/base/json/json_reader.cc File base/json/json_reader.cc (right): https://chromiumcodereview.appspot.com/9801007/diff/14001/base/json/json_reader.cc#newcode491 base/json/json_reader.cc:491: // Consume the UTF-16 code unit, which may be ...
8 years, 9 months ago (2012-03-22 05:51:42 UTC) #3
brettw
BTW this is awesome!
8 years, 9 months ago (2012-03-22 05:51:50 UTC) #4
Robert Sesek
http://codereview.chromium.org/9801007/diff/14001/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/14001/base/json/json_reader.cc#newcode491 base/json/json_reader.cc:491: // Consume the UTF-16 code unit, which may be ...
8 years, 9 months ago (2012-03-22 17:59:57 UTC) #5
brettw
http://codereview.chromium.org/9801007/diff/22001/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/22001/base/json/json_reader.cc#newcode566 base/json/json_reader.cc:566: return (HexDigitToInt(*(buf + 1)) << 12) + You didn't ...
8 years, 9 months ago (2012-03-22 20:23:23 UTC) #6
Robert Sesek
http://codereview.chromium.org/9801007/diff/22001/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/22001/base/json/json_reader.cc#newcode566 base/json/json_reader.cc:566: return (HexDigitToInt(*(buf + 1)) << 12) + On 2012/03/22 ...
8 years, 9 months ago (2012-03-22 20:52:16 UTC) #7
Mark Mentovai
http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc#newcode487 base/json/json_reader.cc:487: decoded_str.push_back((HexDigitToInt(*(token.begin + i + 1)) << 4) + HexStringToInt ...
8 years, 9 months ago (2012-03-22 21:06:20 UTC) #8
Robert Sesek
On 2012/03/22 21:06:20, Mark Mentovai wrote: > http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc > File base/json/json_reader.cc (right): > > http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc#newcode487 ...
8 years, 9 months ago (2012-03-23 15:51:41 UTC) #9
brettw
http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc#newcode488 base/json/json_reader.cc:488: HexDigitToInt(*(token.begin + i + 2))); Let's do Mark's suggestion. ...
8 years, 9 months ago (2012-03-23 16:29:24 UTC) #10
Robert Sesek
http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc File base/json/json_reader.cc (right): http://codereview.chromium.org/9801007/diff/25003/base/json/json_reader.cc#newcode488 base/json/json_reader.cc:488: HexDigitToInt(*(token.begin + i + 2))); On 2012/03/23 16:29:24, brettw ...
8 years, 9 months ago (2012-03-23 18:40:27 UTC) #11
brettw
lgtm
8 years, 9 months ago (2012-03-23 19:10:49 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsesek@chromium.org/9801007/21009
8 years, 9 months ago (2012-03-23 21:43:58 UTC) #13
commit-bot: I haz the power
Try job failure for 9801007-21009 (retry) on mac_rel for step "update". It's a second try, ...
8 years, 9 months ago (2012-03-23 23:31:25 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/rsesek@chromium.org/9801007/21009
8 years, 9 months ago (2012-03-24 00:44:42 UTC) #15
commit-bot: I haz the power
8 years, 9 months ago (2012-03-24 03:57:18 UTC) #16
Change committed as 128678

Powered by Google App Engine
This is Rietveld 408576698