actor-framework icon indicating copy to clipboard operation
actor-framework copied to clipboard

Revisit cache line size constants

Open riemass opened this issue 2 months ago • 0 comments

Currently, we use CAF_CACHE_LINE_SIZE with the value of 64 bytes to prevent false sharing in the actor_control_block and default_mailbox.

Intel and AMD use 64, but Apple Silicone switched to 128 bytes with the M-series processors. However, research suggests that internally, the cache line size is still 64 bytes, although reported as 128.

Regarding cache-line size, sysctl on macOS reports a value of 128 B, while getconf and the CTR_EL0 register on Asahi Linux returns 64 B, which is also supported by our measurements. [1]

While getting the cacheline size via software gives us 128 bytes, I think physically it is actually 64 bytes. In this benchmark even if you change the alignment to 64, the performance remains exactly the same. [2]

The research lowers the priority of this task, but we should handle it properly. Here are some suggestions how to do it:

  • a CMake generated constant in build_config,
  • use the std library,
  • use fixed 128 bytes

riemass avatar Dec 10 '25 08:12 riemass