Hi.
I'm profiling some coroutine code, and finding suprising results, which I'd like to sense check around Coroutines / Flow's use of exceptions.
According to YoutKit profiler, we have 2 hotspots in our code - which all point to
result.throwOnFailure
This code is counting for nearly 93% of our CPU time when we're under load.
I've debugged, and see the error getting thrown are:
`kotlinx.coroutines.flow.internal.ChildCancelledException`:
Child of the scoped flow was cancelled
(which is designed not to populate the stack trace -- good thing)
kotlinx.coroutines.flow.internal.AbortFlowException
Flow was aborted, no more elements needed -
(appears as though it does capture the stack, not 100% sure though).
Assuming the root cause is that we're misusing the framework somehow, It's not obvious to me where these errors are being generated in our code.
Anyone had experience with this, or got pointers on how to improve this?