Skip to content

Coroutine cancellation calls Class#getSimpleName on JVM #3899

Open
@louispf

Description

@louispf

I was doing some trace analysis for an Android application and I noticed that CoroutineScope#cancel was taking up a very large part of this particular microbenchmark run (1/3rd of total allocations, 40% of time) - in particular one obvious thing seems to be the use of Class#getSimpleName, which comes from:

https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/JobSupport.kt#L416

Which uses:

https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/jvm/src/DebugStrings.kt#L21

Would it be possible to remove this / replace it with something cheaper? There are some other areas for improvement here I think (some of this is tracked in #3887), but this looks like a simpler task

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions