Re: Self-Modifying code for user settings optimization

2016-01-10 Thread Jay Norwood via Digitalmars-d
On Saturday, 9 January 2016 at 21:09:05 UTC, Jason Jeffory wrote: It might, which is why I asked, seems like it would be something trivial to do if the address of the function and relative address of the "variable" can be gotten at "compile time"(not sure it is possible by maybe one could

Self-Modifying code for user settings optimization

2016-01-09 Thread Jason Jeffory via Digitalmars-d
Instead of something like DoSomething(UserSettings["width"]); Which requires an access to UserSettings, which may be slow in time critical code(but you want to provide some way to configure various behaviors), why not use self-modifying code? DoSomething(3); // 3 maybe the default, but a

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Jason Jeffory via Digitalmars-d
On Saturday, 9 January 2016 at 10:41:23 UTC, Rikki Cattermole wrote: I've been looking into this issue for web routing. Over all its definitely more performant. But: - You need some way to generate code - ABI compatibility - Host binary compatibility (not the same as ABI) - Front end for the

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Rikki Cattermole via Digitalmars-d
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

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Rikki Cattermole via Digitalmars-d
On 10/01/16 12:32 AM, Jason Jeffory wrote: On Saturday, 9 January 2016 at 10:41:23 UTC, Rikki Cattermole wrote: I've been looking into this issue for web routing. Over all its definitely more performant. But: - You need some way to generate code - ABI compatibility - Host binary compatibility

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Rikki Cattermole via Digitalmars-d
I've been looking into this issue for web routing. Over all its definitely more performant. But: - You need some way to generate code - ABI compatibility - Host binary compatibility (not the same as ABI) - Front end for the "language" to specify what to generate I'm either going sljit way or my

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread John Colvin via Digitalmars-d
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.

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Jason Jeffory via Digitalmars-d
On Saturday, 9 January 2016 at 11:38:06 UTC, Rikki Cattermole wrote: On 10/01/16 12:32 AM, Jason Jeffory wrote: On Saturday, 9 January 2016 at 10:41:23 UTC, Rikki Cattermole wrote: I've been looking into this issue for web routing. Over all its definitely more performant. But: - You need some

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread John Colvin via Digitalmars-d
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

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Jason Jeffory via Digitalmars-d
On Saturday, 9 January 2016 at 23:43:32 UTC, Rikki Cattermole wrote: interface IFoo { void a(); void b(); } __gshared IFoo a, b; __gshared IFoo instance; class Foo(bool bar) : IFoo { void a() { static if (bar) { // do something

Re: Self-Modifying code for user settings optimization

2016-01-09 Thread Rikki Cattermole via Digitalmars-d
interface IFoo { void a(); void b(); } __gshared IFoo a, b; __gshared IFoo instance; class Foo(bool bar) : IFoo { void a() { static if (bar) { // do something } else { // do nothing