This PR improves performance of actor spawning by ~16% by reducing the memory size of ActorID with the use of interning the inner PeerId. This reduces the size of ActorID from 96 to 16, which gives a nice performance increase when creating and copying ActorIDs.
Important note:
Creating ActorIDs with different PeerIds is technically a memory leak, since the cache of PeerIds is never cleaned up. However the size of a PeerId is 80 bytes, and so for 1MB of memory to be used, you'd need to have 12,500 unique PeerIds used, which could technically happen if they're created randomly and frequently, however nodes shouldn't be changed that often for this to be an issue.
This PR improves performance of actor spawning by ~16% by reducing the memory size of
ActorID
with the use of interning the inner PeerId. This reduces the size of ActorID from 96 to 16, which gives a nice performance increase when creating and copyingActorID
s.Important note: Creating
ActorID
s with different PeerIds is technically a memory leak, since the cache of PeerIds is never cleaned up. However the size of a PeerId is 80 bytes, and so for 1MB of memory to be used, you'd need to have 12,500 unique PeerIds used, which could technically happen if they're created randomly and frequently, however nodes shouldn't be changed that often for this to be an issue.Fixes https://github.com/tqwewe/kameo/issues/42