Self-Modifying code for user settings optimization

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 9 08:15:15 PST 2016


On Saturday, 9 January 2016 at 14:55:27 UTC, Rikki Cattermole 
wrote:
> 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.

Of course, I just meant that when reading a global or an enum, 
enum isn't necessarily cheaper. static if f.t.w.


More information about the Digitalmars-d mailing list