http://d.puremagic.com/issues/show_bug.cgi?id=859


Leandro Lucarella <llu...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance
                 CC|                            |llu...@gmail.com
           Platform|x86                         |All
            Version|1.00                        |D1 & D2
         OS/Version|Windows                     |All


--- Comment #3 from Leandro Lucarella <llu...@gmail.com> 2010-06-27 18:49:49 
PDT ---
To avoid opening a new bug, I'll reuse this ancient bug report, since the
summary is pretty much the same I'll write for this.

I'm having some performance problems moving some stuff from a lower-level
C-style to a higher-lever D-style. Here is an example:

---
int find_if(bool delegate(ref int) predicate)
{
        for (int i = 0; i < 100; i++)
                if (predicate(i))
                        return i;
        return -1;
}

int main()
{
//      for (int i = 0; i < 100; i++)
//              if (i == 99)
//                      return i;
//      return -1;
        return find_if((ref int i) { return i == 99; });
}
---

The program produced by this source executes 4 times more instructions than the
more direct (lower-level) version commented out. I would expect DMD to inline
all functions/delegates and produce the same asm for both, but that's not the
case.

This is a reduced test-case, but I'm working on improving the GC and I'm really
hitting this problem. If I use this higher-level style in the GC, a Dil run for
generating the Tango docs is 3.33 times slower than the C-ish style used by the
current GC.

So I think this is a real problem for D, it's really important to be able to
encourage people to use the higher-level D constructs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to