Transfer tick state when replacing a blocked thread#4264
Conversation
|
|
||
| private[effect] object WorkerThread { | ||
|
|
||
| private[unsafe] final class TransferState { |
There was a problem hiding this comment.
Is TransferState mutable just to avoid always allocating a new instance? Or am I missing something?
(Also, a possibly stupid idea: we could pack the 2 Ints into one Long... I think that way the transferState field could be avoided. But also, that would cause java.lang.Long object allocations when transferring...)
There was a problem hiding this comment.
Is
TransferStatemutable just to avoid always allocating a new instance?
Yes, that's right.
But also, that would cause
java.lang.Longobject allocations when transferring...
Yes, and they would be unlikely to be cached. The old implementation transferring java.lang.Integers were likely to be cached due to their relatively small values (likely < 64, except on some very large machines).
I think if we want to do better here, we'd need to implement a custom concurrent data structure for transfers.
No description provided.