Closed
Bug 1341902
Opened 7 years ago
Closed 6 years ago
js::Stringify can be really slow on Google Drive
Categories
(Core :: JavaScript Engine, defect, P2)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
Performance Impact | high |
People
(Reporter: ehsan.akhgari, Unassigned)
References
Details
(Keywords: perf)
I got this on <https://drive.google.com/drive/u/1/folders/0BzDhuKIxRtxdY2NucFRIQWZkZlU>. https://perfht.ml/2kNDQ7f We're spending 554ms in js::Stringify.
Comment 1•7 years ago
|
||
js::Stringify converts values to JSON. About half of the time is spent calling back into JS. I don't know if that's the replacer callback or just ToString calls, probably the latter. 61ms of the time is getting properties. I'm not sure if this is just a matter of producing a ton of JSON, or whether we're actually slow here.
Comment 2•7 years ago
|
||
I saved on of the resulting JSON strings locally, turned it back into an object and parsed it a few times with JSON.parse. We seem to spend about 30% of our time in the CycleDetector! perf claims most of this time comes from JS::Zone::getUniqueId, but that might just be inlining. I also changed GetElement to an optimized version for dense arrays, which improves the runtime by 10-20%. This was previously suggest in bug 1313373. Overall looking at some of hot assembly instructions, we should probably try to get rid of most of the Rooted on the stack. Micro optimizing IsQuoteSpecialCharacter might be a win as well, could we for example use some SSE instructions to handle more characters at once.
Comment 3•7 years ago
|
||
Cycle collector time is silly, I filed bug 1342345 for that. We can probably optimize property iteration/gets on plain objects by looking at the shapes directly instead of the slow GetPropertyKeys + GetProperty path. If we see anything weird we can fall back to the slow path. I'll file a bug for that too.
Comment 4•7 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #3) > Cycle collector time Hah, s/collector/detector/
Updated•7 years ago
|
Whiteboard: [qf:p1]
Comment 5•7 years ago
|
||
Now that the dependencies are closed, is there anything left to do here, Jan?
Flags: needinfo?(jdemooij)
Comment 6•7 years ago
|
||
(In reply to Andrew Overholt [:overholt] from comment #5) > Now that the dependencies are closed, is there anything left to do here, Jan? I'm not sure but we're probably still a bit slower here due to bug 1343005 etc.
Depends on: 1343005
Flags: needinfo?(jdemooij)
Reporter | ||
Comment 7•7 years ago
|
||
(In reply to Jan de Mooij [:jandem] from comment #6) > (In reply to Andrew Overholt [:overholt] from comment #5) > > Now that the dependencies are closed, is there anything left to do here, Jan? > > I'm not sure but we're probably still a bit slower here due to bug 1343005 > etc. How important is the remaining work? Should this still remain a [qf:p1]? Can you please verify if js::Stringify is fast enough now? Thanks!
Flags: needinfo?(jdemooij)
Comment 8•7 years ago
|
||
Tom do you still have the Google Drive JSON file?
Flags: needinfo?(jdemooij) → needinfo?(evilpies)
Comment 9•7 years ago
|
||
I added back my logging to Stringify and I am still seeing times of 0.5s to 1s on Google Drive. I have the JSON file locally again, but I am having trouble profiling it. This JSON file is 3.4 MB, without any unnecessary whitespaces. perf just seems to shift the attribution around randomly, but Str seems to be very high.
Flags: needinfo?(evilpies)
Comment 10•7 years ago
|
||
Jan suggests to remeasure against Chrome then readjust priority.
Updated•7 years ago
|
Whiteboard: [qf:p1] → [qf:p2]
Updated•7 years ago
|
Whiteboard: [qf:p2] → [qf:p1]
Updated•7 years ago
|
Whiteboard: [qf:p2] → [qf:p1]
Updated•7 years ago
|
Whiteboard: [qf:p1] → [qf:i60][qf:p1]
Updated•7 years ago
|
Whiteboard: [qf:i60][qf:p1] → [qf:f60][qf:p1]
Updated•6 years ago
|
Whiteboard: [qf:f60][qf:p1] → [qf:f61][qf:p1]
Updated•6 years ago
|
Priority: -- → P2
Comment 12•6 years ago
|
||
Measure this again - chances are this is better now and already basically fixed.
Flags: needinfo?(kvijayan)
Comment 13•6 years ago
|
||
Just measured this. The cycle collector is not showing up at all in the profile, and by a hand-measured stopwatch load timer, we look about the same on load-time as chrome on my machine. Given that both the bugs (bug 1343005 and bug 1342345) that Jan mentioned as issues have been fixed, and the re-measuring shows parity, I think we can mark this as fixed.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(kvijayan)
Resolution: --- → FIXED
Updated•2 years ago
|
Performance Impact: --- → P1
Whiteboard: [qf:f61][qf:p1]
You need to log in
before you can comment on or make changes to this bug.
Description
•