Unrelated to coroutines, but I was looking at the ...
# coroutines
e
Unrelated to coroutines, but I was looking at the code for
limitedParallelism
, and found that the int value is checked with
Copy code
// Save a few bytecode ops
internal fun Int.checkParallelism() = require(this >= 1) { "Expected positive parallelism level, but got $this" }
Was this done because of bytecode size limitations of the Android platform? Or because of something else?
b
I would guess it is virtual call vs setting up a thread for a possible exception. So basically it forces
require(...)
to not be inlined
j
Yes, but it becomes a static call in the bytecode. There's also no threads involved for exceptions. It moves the conditional, exception instantiation, and string builder code to a single location. The call sites only have the single invoke static.