www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2396] New: -O causes very long execution time on foreach loop of large array of structs

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396

           Summary: -O causes very long execution time on foreach loop of
                    large array of structs
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: schveiguy yahoo.com


While porting Tango to D2, I've found the attached file (modified to compile
under phobos) doesn't finish compiling in a reasonable amount of time (a.k.a
never).

The data table is from the Tango locale package, I stripped out the struct only
so there isn't any real tango code, just data.

If I compile the file without -O it compiles in 6 seconds, which seems
reasonable since it's 600k of data.

If you comment out most of the lines in the table, it compiles quickly.  As you
add lines back in, the runtime seems to grow exponentially (not scientifically
verified).

This file compiles fine with -O under dmd 1.x, Here's a list of dmd2 compilers
that I had on my system to try out:

2.015, 2.016, 2.018: also fails
2.006, 2.007: works

Note that in 2.006 and 2.007, it compiled much quicker with -O (.3 seconds)
than without -O using the compilers that fail (6 seconds)


-- 
Oct 06 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396





------- Comment #1 from schveiguy yahoo.com  2008-10-06 14:31 -------
Created an attachment (id=275)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=275&action=view)
file to demonstrate bug


-- 
Oct 06 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396





------- Comment #2 from schveiguy yahoo.com  2008-10-06 16:15 -------
BTW, this isn't exactly a blocker for Tango/D2, but in order to get it to work,
I have to hand-compile the file, as the build-script uses -O for all Tango
files.


-- 
Oct 06 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396





------- Comment #3 from bugzilla digitalmars.com  2008-10-07 03:23 -------
Pulling out part of the loop body as a separate function or nested function
should work as a workaround.


-- 
Oct 07 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au


--- Comment #4 from Don <clugdbug yahoo.com.au> 2011-06-23 03:41:47 PDT ---
On DMD2.053 and later, the literal needs to be declared with 'enum' rather than
'static const' to expose the bug.

It's slow because in this case, there is a single expression consisting of
14013 comma expressions, and several places in the backend use algorithms which
are in O(commadepth ^^ 2).
One of the slowest is accumrd() in gflow.c. 

There is also something slow in loopopt(), boolopt() and in builddags().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |damianday hotmail.co.uk


--- Comment #5 from yebblies <yebblies gmail.com> 2012-02-02 01:26:21 EST ---
*** Issue 6771 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha yahoo.com


--- Comment #6 from yebblies <yebblies gmail.com> 2012-02-02 01:26:32 EST ---
*** Issue 5684 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |beirich2 gmail.com


--- Comment #7 from yebblies <yebblies gmail.com> 2012-02-02 01:26:44 EST ---
*** Issue 6643 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 01 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2396



--- Comment #8 from Martin Nowak <code dawg.eu> 2013-03-12 12:21:56 PDT ---
*** Issue 6771 has been marked as a duplicate of this issue. ***

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