Changes planned for 2.07
An update on some work I've been doing for a forthcoming 2.07.00 release.
Mainly I've been adding support for aligned allocation of actor and message objects, another feature useful in embedded and games console environments. The changes allow messages and actors to be 'marked up' with their memory alignment requirements. The markup is by means of macros, similar to the existing markup for type names.
// A message type that requires alignment.
struct THERON_PREALIGN(16) AlignedMessage
{
// contents here
} THERON_POSTALIGN(16);
THERON_ALIGN_MESSAGE(AlignedMessage, 16);
When the marked objects are allocated by Theron, the system requests aligned memory blocks from the global allocator. The SimpleAllocator used by default doesn't actually support alignment, and just ignores alignment requests. But users can supply their own allocator, which does.
On games consoles it is common for math vectors to need 16-byte alignment, meaning they must always be allocated at 16-byte boundaries in memory. Some objects must also be aligned to 128-byte cache line boundaries. The changes allow Theron to be used with message and actor objects containing such types.
In the process I've been reworking the memory block caching. As well as the allocation system, the caching system needs to be made alignment aware. Fortunately the changes generally amount to a simplification to the caching -- arguably one of the more overly complex areas of Theron.
So far there is a small slowdown in the ThreadRing benchmark, of around 10%. For example, sending 50 million messages on my home machine now takes around 29 seconds, whereas before it took around 27 seconds. I'm still optimizing and it may be possible to improve the slowdown; it's not clear yet how much of it is genuinely due to the alignment overhead and how much due to my forced rework of the caching.
Anyway 5% or 10% seems to me a worthwhile price to pay for the benefit of supporting aligned allocations. It's important to remember that's 10% change in raw message processing speed, not in the overall speed of a real system, which is doing real processing and not just message handling.
Story published 13 February 2011.