You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reduce contention on worker's lock in CoroutineScheduler (#3686)
The previous implementation was prone to a non-trivial contention that caused EDT freezes and, potentially, Android's ANRs.
Two root causes were identified:
1) Thread() constructor that has a non-trivial complexity along with JVM upcalls and is significantly slower than any other regular allocation
2) Thread.start() is on itself a JVM upcall that ends up on a global JVM lock[s]
Thread.start() is now invoked when the lock is released to reduce contention.
The first root cause is not addressed as optimistic thread allocation may lead to a potential CPU waste due to how optimistically lock-less detection is and because Thread.start() is an order of magnitude slower anyway
Fixes#3652
0 commit comments