www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - force inline/not-inline

reply Manu <turkeyman gmail.com> writes:
--bcaec517aca072c39b04bb7832cd
Content-Type: text/plain; charset=UTF-8

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?

--bcaec517aca072c39b04bb7832cd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I just started writing an emulator in D for some fun; I needed an applicati=
on to case-study aggressive performance characteristics in hot-loop situati=
ons.<div>I know this has come up time and time again, but I just want to pu=
t it out there again... if I were shipping this product, I would NEED force=
inline + force-not-inline.<br>
<div><br></div></div><div>I know D likes to try and intelligently inline co=
de, but in these very high performance cases, I know what&#39;s best for my=
 code, and I have also shipped this product commercially before. I know exa=
ctly what was required of it from months of meticulous performance profilin=
g, and I can see immediately that D is not making the right choices. Progra=
mmers need to be able to explicitly control to inline-ing in many cases.</d=
iv>
<div><br></div><div>Cross module inline-ing is a really big problem. What i=
s the plan here? Is there a solution in the foreseeable future? What about =
libs?</div>

--bcaec517aca072c39b04bb7832cd--
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 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?

Currently I use string mixins to force inlining - but that's uggly
Mar 18 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf3074b3dac2f57c04bb82e8ce
Content-Type: text/plain; charset=UTF-8

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. --20cf3074b3dac2f57c04bb82e8ce Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 18 March 2012 10:56, Adrian <span dir=3D"ltr"=
&lt;<a href=3D"mailto:adrian.remove-nospam veith-system.de">adrian.remove-=

quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1= ex"> +1<br> <br> Currently I use string mixins to force inlining - but that&#39;s uggly<br> </blockquote></div><br><div>Yeah, that&#39;s not an acceptable workaround. = I couldn&#39;t write commercial/large-team code that way.</div> --20cf3074b3dac2f57c04bb82e8ce--
Mar 18 2012
prev sibling next sibling 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