Optimize dumpCoroutinesInfoAsJsonAndReferences #4323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've removed
trimIndent
andtoStringRepr
calls, made during the composition of coroutine dump json.The motivation: Intellij IDEA Debugger supports the Coroutine View, which can show the hierarchy of all the available coroutines. This View struggled of sever performance issues (IDEA-335303). There were reasons for that on the debugger side, like fetching additional information for each coroutine. But other than that, the invocation of
dumpCoroutinesInfoAsJsonAndReferences
took significant amount of time.I made some dumb performance measurements on the dumps of ~5000 coroutines, the absolute time is irrelevant ofc, just % of time of the parent call are:
trimIndent
:trimIndent
invocation:toStringRepr
invocation as well, it finally makes sense and showsdumpCoroutineInfos
as the next significant call:It's not necessary to call
trimIndent
on every piece of this JSON, so that it could be parsed on the debugger side. So, I suggest to optimize this code.