Self-Modifying code for user settings optimization

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 9 06:55:27 PST 2016


On 10/01/16 3:50 AM, John Colvin wrote:
> On Saturday, 9 January 2016 at 11:38:06 UTC, Rikki Cattermole wrote:
>> Enums are free and global variables may have cache misses issue
>
> An enum isn't guaranteed to be embedded in the instruction stream,
> there's still plenty of opportunities for cache misses.

enum FOO = true;

static if (FOO) {
	doThis();
} else {
	doThat();
}

No need for enum to be embedded in the instruction stream.
Because it won't be. The else block just doesn't get compiled in.


More information about the Digitalmars-d mailing list