Re: Inline Functions

2009-03-02 Thread Sergey Gromov
Mon, 02 Mar 2009 07:12:41 -0500, Mason Green wrote: > Excellent, I've implemented your optimizations and left a more > detailed comment on the blog. I've also made a number of > optimizations to the physics engine over the weekend, and the > performance increase is phenomenal! > > http://svn.ds

Re: Inline Functions

2009-03-02 Thread Mason Green
Excellent, I've implemented your optimizations and left a more detailed comment on the blog. I've also made a number of optimizations to the physics engine over the weekend, and the performance increase is phenomenal! http://svn.dsource.org/projects/blaze/downloads/blazeDemos.zip Much apprecia

Re: Inline Functions

2009-03-01 Thread Sergey Gromov
Thu, 26 Feb 2009 19:42:20 +0300, Sergey Gromov wrote: > Tue, 24 Feb 2009 14:08:26 -0500, Mason Green wrote: > >>> Have you profiled your D code? What has the profiling told you? Have you >>> seen where you allocate memory, to move such allocations away from inner >>> loops, or just reduce their

Re: Inline Functions

2009-02-27 Thread TomD
Walter Bright Wrote: > Sergey Gromov wrote: [...] > > Heh, thanks! I hope my opus really worths mentioning. > > I think it is. Shouldn't things like these maybe be included under the "Tech Tips" on digitalmars.com or so? Ciao TomD

Re: Inline Functions

2009-02-26 Thread Walter Bright
Sergey Gromov wrote: Thu, 26 Feb 2009 14:43:11 -0800, Walter Bright wrote: Sergey Gromov wrote: http://snakecoder.wordpress.com/2009/02/26/profiling-with-dmd-on-windows/ I already have some material for the second one, profiling Blaze. ;-) http://www.reddit.com/r/d_language/comments/80lpm/p

Re: Inline Functions

2009-02-26 Thread Sergey Gromov
Thu, 26 Feb 2009 14:43:11 -0800, Walter Bright wrote: > Sergey Gromov wrote: >> http://snakecoder.wordpress.com/2009/02/26/profiling-with-dmd-on-windows/ >> >> I already have some material for the second one, profiling Blaze. ;-) > > http://www.reddit.com/r/d_language/comments/80lpm/profiling_w

Re: Inline Functions

2009-02-26 Thread Walter Bright
Sergey Gromov wrote: http://snakecoder.wordpress.com/2009/02/26/profiling-with-dmd-on-windows/ I already have some material for the second one, profiling Blaze. ;-) http://www.reddit.com/r/d_language/comments/80lpm/profiling_with_digital_mars_d_compiler_on_windows/

Re: Inline Functions

2009-02-26 Thread Sergey Gromov
Tue, 24 Feb 2009 14:08:26 -0500, Mason Green wrote: >> Have you profiled your D code? What has the profiling told you? Have you >> seen where you allocate memory, to move such allocations away from inner >> loops, or just reduce their number? > > > No, I have not profiled the D code other than

Re: Inline Functions

2009-02-25 Thread Walter Bright
Jarrett Billingsley wrote: True. However defining what the compiler does in these optimizations is not just in the interest of performance, but also in the interest of correctness and other implementations. Optimization should have nothing to do with correctness. If everyone can see what DMD

Re: Inline Functions

2009-02-25 Thread Jarrett Billingsley
On Wed, Feb 25, 2009 at 8:59 PM, Walter Bright wrote: > Jarrett Billingsley wrote: >> >> Also, looking at the DMD frontend source is *not* an acceptable option. > > I knew you'd say that . I knew you'd suggest it ;) > On the other hand, inlining or not is, like register allocation and any > othe

Re: Inline Functions

2009-02-25 Thread Walter Bright
Jarrett Billingsley wrote: Also, looking at the DMD frontend source is *not* an acceptable option. I knew you'd say that . On the other hand, inlining or not is, like register allocation and any other optimizations, highly implementation dependent. If you're going to micro-optimize at that l

Re: Inline Functions

2009-02-25 Thread Walter Bright
Jarrett Billingsley wrote: In this case it's not entirely helpful that DMD's inlining rules are completely opaque. Do you have a list of what DMD will and won't inline, and their justifications? If not, could you make one? In the immortal words of Oggie-Ben-Doggie, "use the source, Luke". In

Re: Inline Functions

2009-02-25 Thread bearophile
Mason Green: > I made a few fixes to my demo, and it now appears to run on par with Java. It > seems I made a very rookie mistake on my main demo loop. > > Check out Blaze demo #3: > http://svn.dsource.org/projects/blaze/downloads/blazeDemos.zip Why do you use lines with a thickness of 2? Antial

Re: Inline Functions

2009-02-25 Thread Daniel Keep
Mason Green wrote: > Hi, > > I made a few fixes to my demo, and it now appears to run on par with Java. It > seems I made a very rookie mistake on my main demo loop. > > Check out Blaze demo #3: > http://svn.dsource.org/projects/blaze/downloads/blazeDemos.zip > > Cycle through (with arrows) a

Re: Inline Functions

2009-02-25 Thread Mason Green
Hi, I made a few fixes to my demo, and it now appears to run on par with Java. It seems I made a very rookie mistake on my main demo loop. Check out Blaze demo #3: http://svn.dsource.org/projects/blaze/downloads/blazeDemos.zip Cycle through (with arrows) and compare it to the Java pyramid stres

Re: Inline Functions

2009-02-25 Thread Jarrett Billingsley
On Wed, Feb 25, 2009 at 9:09 AM, Jarrett Billingsley wrote: > On Wed, Feb 25, 2009 at 3:26 AM, Walter Bright > wrote: >> >> Also, if you are trying to optimize the code by trying various tweaks at the >> statement level, it's much like shooting skeet blindfolded if you don't look >> at the asm ou

Re: Inline Functions

2009-02-25 Thread Jarrett Billingsley
On Wed, Feb 25, 2009 at 3:26 AM, Walter Bright wrote: > > Also, if you are trying to optimize the code by trying various tweaks at the > statement level, it's much like shooting skeet blindfolded if you don't look > at the asm output. It's time consuming and unlikely to be successful. In this cas

Re: Inline Functions

2009-02-25 Thread Walter Bright
Tomas Lindquist Olsen wrote: perhaps a verbose mode could be added in dmd that prints the pretty printed declaration when a function is inlined. then it would be a simple grep to make sure. dmd -vi foo.d | grep 'foo\.inc' telling people to inspect the obj2asm output seems to be popular, but it'

Re: Inline Functions

2009-02-25 Thread Tomas Lindquist Olsen
On Wed, Feb 25, 2009 at 8:42 AM, Walter Bright wrote: > Mason Green (Zzzzrrr) wrote: >> >> When I remove -inline there doesn't seem to >> be much of a difference in execution speed. > > Try running obj2asm to see if the functions you want inlined are actually > inlined or not. > perhaps a verbose

Re: Inline Functions

2009-02-24 Thread Walter Bright
Mason Green (Zzzzrrr) wrote: When I remove -inline there doesn't seem to be much of a difference in execution speed. Try running obj2asm to see if the functions you want inlined are actually inlined or not.

Re: Inline Functions

2009-02-24 Thread grauzone
Both LDC and GDC inline the function. (LDC actually reduces your code to nothing, so I had to change it a bit to see if the call was really inlined.)

Re: Inline Functions

2009-02-24 Thread dsimcha
== Quote from bearophile (bearophileh...@lycos.com)'s article > dsimcha: > >I think you're right, strange as it seems. I wonder why ref is never > >inlined.< > Do you want something like a forced_inline attribute in D? :-) > Bye, > bearophile No, actually, I like the idea of leaving these small

Re: Inline Functions

2009-02-24 Thread bearophile
dsimcha: >I think you're right, strange as it seems. I wonder why ref is never inlined.< Do you want something like a forced_inline attribute in D? :-) Bye, bearophile

Re: Inline Functions

2009-02-24 Thread dsimcha
== Quote from Bill Baxter (wbax...@gmail.com)'s article > I seem to remember from a previous discussion about optimizing a > ray-tracer that DMD will not inline functions that take reference > parameters. Can anyone else confirm this? > --bb Here's a test program I wrote

Re: Inline Functions

2009-02-24 Thread Bill Baxter
I seem to remember from a previous discussion about optimizing a ray-tracer that DMD will not inline functions that take reference parameters. Can anyone else confirm this? --bb

Re: Inline Functions

2009-02-24 Thread Lutger
Mason Green wrote: > bearophile: > > Thanks for the reply. > >> A JavaVM like HotSpot is more refined than the backend of DMD, its GC is much more refined and more efficient, it's much better in inlining virtual methods, its data structures are usually better performance-tuned, etc. The D la

Re: Inline Functions

2009-02-24 Thread Denis Koroskin
On Tue, 24 Feb 2009 22:08:26 +0300, Mason Green wrote: bearophile: Thanks for the reply. A JavaVM like HotSpot is more refined than the backend of DMD, its GC is much more refined and more efficient, it's much better in inlining virtual methods, its data structures are usually better

Re: Inline Functions

2009-02-24 Thread Mason Green
bearophile: Thanks for the reply. > A JavaVM like HotSpot is more refined than the backend of DMD, its GC is much > more refined and more efficient, it's much better in inlining virtual > methods, its data structures are usually better performance-tuned, etc. The D > language is newer than Ja

Re: Inline Functions

2009-02-24 Thread bearophile
Mason Green: >I'm looking for ways to optimize Blaze, the D port of Box2D, and running into >some frustrations. In fact, the same Java port >(http://www.jbox2d.org/v2demos/) is currently running circles around Blaze, >performance wise< In the beginning the Java code used to run very slowl

Inline Functions

2009-02-24 Thread Zzzzrrr
Hello, I'm looking for ways to optimize Blaze, the D port of Box2D, and running into some frustrations. In fact, the same Java port (http://www.jbox2d.org/v2demos/) is currently running circles around Blaze, performance wise I have a sneaking suspicion that this is the result of the many

Inline Functions

2009-02-24 Thread Zzzzrrr
Hello, I'm looking for ways to optimize Blaze, the D port of Box2D, and running into some frustrations. In fact, the same Java port (http://www.jbox2d.org/v2demos/) is currently running circles around Blaze, performance wise I have a sneaking suspicion that this is the result of the many