base::internal::JSONParser increases from 0.15% to 0.5% during session restore |
|||
Issue descriptionAccording to CWP data (see go/cwp), the percentage of CPU cycles spent in base::internal::JSONParser has increased from 0.15% to 0.35-0.5%. See attached graph. I don't have deeper insights into which functions have increased but I can keep digging and find out more. Will assign to the right person when I find that information.
,
Apr 1 2016
95% of the samples in JSONParser on ver 7647.84.0 (one of the largest stable channel versions in March) on RESTORE_SESSION come from JSONParser::ConsumeDictionary(). From the above data, 75% of ConsumeDictionary() samples come from line 519 and another 15% come from line 505. 7647 is M48, which branched Nov 13, 2015. The oldest post-branch change to JSONParser is this: http://crrev.com/1538743002 Looking at the patch, lines 519 and 515 correspond to: 505 if (!ConsumeStringRaw(&key)) { and 519 Value* value = ParseNextToken(); Looking at ParseNextToken(): Value* JSONParser::ParseNextToken() { return ParseToken(GetNextToken()); } Both ParseToken() and GetNextToken() contain a switch block. It would be useful to look at whether these are compiled as a series of branches as opposed to a table lookup.
,
Apr 1 2016
Looking at locally compiled code, I see that: 1. ParseToken() has a sequence of comparisons and jumps for its 7-case switch statement. 2. GetNextToken() uses a lookup table. 3. But GetNextToken() also calls EatWhitespaceAndComments() which has a 5-case switch block inside a for loop, and the switch statement is compiled as comparisons and jumps. I haven't taken a look at ConsumeStringRaw's disassembly but I do see an 11-case switch statement in it. The statements on lines 505 and 519 are also both in a while loop, meaning that speedups inside the while loop would be multiplied by the number of iterations. Luis, do you think these could be sped up by using lookup tables for switch statements in more places?
,
Jul 26 2016
|
|||
►
Sign in to add a comment |
|||
Comment 1 by sque@chromium.org
, Mar 31 2016