The root of all anvils (and evil)

9, Apr, 2019

So many times, I saw a such object:

{
    ...

    bool a;
    bool b;
    bool c;
    bool d;
    ...
}

So many times it ended the same. The objects were constructed in millions. Memory consumption was high, unaligned accesses with cache misses run through the app because that class was 65 bytes…

But, you may optimize this latter? Really? Not, so.

The object structure reflected, how it was serialized. The fastest way was push it as a binary blob to our internal format. We cannot convert all the legacy data. Now, even if we optimize the run time, we have hard time on load and save - we need a parser. Congratulations one thing optimized, another has been made slower.

All that was needed from he beginning:

{
    ...

    int a:1;
    int b:1;
    int c:1;
    int d:1;
    ...
}