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
__NBN_Connection is big enough (a little above 1 MB per connection) that it doesn't fit into the L2 cache of many systems.
A quick look into a frequently called function like Connection_ReadNextMessageFromStream shows that channels and endpoint are accessed often and immediately after each other, however, their positions in the struct are very far apart. On my Linux 64b system they look like this:
(gdb) p offsetof(NBN_Connection, channels)
$1 = (NBN_Channel *(*)[32]) 0x107318
(gdb) p offsetof(NBN_Connection, endpoint)
$2 = (struct __NBN_Endpoint **) 0x30
More than a MB apart. I believe this is introducing cache misses and impacting performance. The fix is very straightforward: move frequently used members of the struct closer together.
The text was updated successfully, but these errors were encountered:
__NBN_Connection is big enough (a little above 1 MB per connection) that it doesn't fit into the L2 cache of many systems.
A quick look into a frequently called function like Connection_ReadNextMessageFromStream shows that
channels
andendpoint
are accessed often and immediately after each other, however, their positions in the struct are very far apart. On my Linux 64b system they look like this:More than a MB apart. I believe this is introducing cache misses and impacting performance. The fix is very straightforward: move frequently used members of the struct closer together.
The text was updated successfully, but these errors were encountered: