force inline/not-inline

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 26 20:26:24 PDT 2015


On Sunday, 26 July 2015 at 21:58:02 UTC, Brandon Ragland wrote:
> On Saturday, 24 August 2013 at 19:13:49 UTC, jerro wrote:
>> On Saturday, 17 March 2012 at 22:53:58 UTC, Manu wrote:
>>> I just started writing an emulator in D for some fun; I 
>>> needed an
>>> application to case-study aggressive performance 
>>> characteristics in
>>> hot-loop situations.
>>> I know this has come up time and time again, but I just want 
>>> to put it out
>>> there again... if I were shipping this product, I would NEED 
>>> forceinline +
>>> force-not-inline.
>>
>> You could use GDC and @attribute("forceinline") and
>> @attribute("noinline"). But I agree it would be nice to have
>> something like that as a part of the language.
>
> Don't mean to resurrect an old thread but was working n a 
> project to replace a few C programs today, that are 
> time-sensitive and process fairly large batches of files, for 
> live-use.
>
> Was looking for a way to inline a few function calls that could 
> shave a few seconds off my run time today, ended up using GDC 
> attribute flags but was hoping the language had this feature.
>
> Though I understand it intelligently decides, sometimes it 
> doesn't do so well.
>
> Case in point might be a call that at first glance doesn't get 
> called often, but when in production, gets called thousands of 
> times. That could be massive savings if it were able to force 
> inline.

It's in, merged a couple months ago, will be in the upcoming 
2.068 release:

https://github.com/D-Programming-Language/dmd/pull/4723


More information about the Digitalmars-d mailing list