March 17, 2012 force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Attachments:
| 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? |
March 17, 2012 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | 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 |
March 18, 2012 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | 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
|
March 18, 2012 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adrian Attachments:
| 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. |
August 24, 2013 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | Bump. Will forceinline be introduced? |
August 24, 2013 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manu | 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.
|
July 26, 2015 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to jerro | 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.
-Brandon
|
July 26, 2015 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brandon Ragland | 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: >> [...] > > 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. > > -Brandon It looks like support is being considered: http://dlang.org/pragma.html#inline |
July 27, 2015 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gary Willoughby | On Sunday, 26 July 2015 at 22:59:49 UTC, Gary Willoughby wrote:
> It looks like support is being considered:
>
> http://dlang.org/pragma.html#inline
Yeah. IIRC, there was a big discussion a few months back on how pragma(inline) worked vs how it should work. In particular, I think that there was a big dispute over whether pragma(inline, true) should force inlining outright or make it so that it gave you an error if it wasn't inlined. I'd have to go find that discussion and dig through it though to know for sure what was being discussed exactly. I paid some attention to it, but not a lot.
- Jonathan M Davis
|
July 27, 2015 Re: force inline/not-inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brandon Ragland | 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 |
Copyright © 1999-2021 by the D Language Foundation