actor: Potential systemQueuePut improvement
It seems when no system messages need to be handled, systemQueuePut is mostly called with both lists being empty. In that case, we try to avoid the CAS overhead. This changes behavior at least in two regards: * no volatile memory access, so there's no barrier (but is that required?) * one less opportunity for competing threads to put a message into the queue and have that being delivered immediately, so the previous version could be seen as an extra poll (but would that be needed for anything?)
This commit is contained in:
parent
7fc591c182
commit
f315e9693c
1 changed files with 1 additions and 0 deletions
|
|
@ -210,6 +210,7 @@ private[akka] abstract class Mailbox(val messageQueue: MessageQueue)
|
|||
Unsafe.instance.getObjectVolatile(this, AbstractMailbox.systemMessageOffset).asInstanceOf[SystemMessage])
|
||||
|
||||
protected final def systemQueuePut(_old: LatestFirstSystemMessageList, _new: LatestFirstSystemMessageList): Boolean =
|
||||
(_old.head eq _new.head) ||
|
||||
// Note: calling .head is not actually existing on the bytecode level as the parameters _old and _new
|
||||
// are SystemMessage instances hidden during compile time behind the SystemMessageList value class.
|
||||
// Without calling .head the parameters would be boxed in SystemMessageList wrapper.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue