-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize dumpCoroutinesInfoAsJsonAndReferences #4323
base: develop
Are you sure you want to change the base?
Optimize dumpCoroutinesInfoAsJsonAndReferences #4323
Conversation
…d toStringRepr calls. `trimIndent` and `toStringRepr` calls cause a significant overhead for json dump for a large number of coroutines.
@mvicsokolova, is there a way to improve |
Yes, I'll create a ticket for trimIndent optimization in kotlin-stdlib 👍🏼 |
I'm not sure for now though, what's the better way to deal with special symbols in the coroutine name, than the current |
Yes,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to merge this, at least trimIndent
's functionality should be recreated by deindenting the string (with an additional comment explaining that the abscence of trimIndent
is intentional); otherwise, we get redundant whitespace in the result.
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.