www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - force inline/not-inline

reply Manu <turkeyman gmail.com> writes:
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.

I know D likes to try and intelligently inline code, but in these very high
performance cases, I know what's best for my code, and I have also shipped
this product commercially before. I know exactly what was required of it
from months of meticulous performance profiling, and I can see immediately
that D is not making the right choices. Programmers need to be able to
explicitly control to inline-ing in many cases.

Cross module inline-ing is a really big problem. What is the plan here? Is
there a solution in the foreseeable future? What about libs?
Mar 17 2012
next sibling parent =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> writes:
On 17-03-2012 23:53, 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.

 I know D likes to try and intelligently inline code, but in these very
 high performance cases, I know what's best for my code, and I have also
 shipped this product commercially before. I know exactly what was
 required of it from months of meticulous performance profiling, and I
 can see immediately that D is not making the right choices. Programmers
 need to be able to explicitly control to inline-ing in many cases.

Amen.
 Cross module inline-ing is a really big problem. What is the plan here?
 Is there a solution in the foreseeable future? What about libs?

-- - Alex
Mar 17 2012
prev sibling next sibling parent reply Adrian <adrian.remove-nospam veith-system.de> writes:
Am 17.03.2012 23:53, schrieb Manu:
 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.

 I know D likes to try and intelligently inline code, but in these very
 high performance cases, I know what's best for my code, and I have also
 shipped this product commercially before. I know exactly what was
 required of it from months of meticulous performance profiling, and I
 can see immediately that D is not making the right choices. Programmers
 need to be able to explicitly control to inline-ing in many cases.

 Cross module inline-ing is a really big problem. What is the plan here?
 Is there a solution in the foreseeable future? What about libs?

+1 Currently I use string mixins to force inlining - but that's uggly
Mar 18 2012
parent reply Manu <turkeyman gmail.com> writes:
On 18 March 2012 10:56, Adrian <adrian.remove-nospam veith-system.de> wrote:

 +1

 Currently I use string mixins to force inlining - but that's uggly

Yeah, that's not an acceptable workaround. I couldn't write commercial/large-team code that way.
Mar 18 2012
parent "Temtaime" <temtaime gmail.com> writes:
Bump.
Will forceinline be introduced?
Aug 24 2013
prev sibling parent "jerro" <a a.com> writes:
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.
Aug 24 2013