public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50693] New: Slightly different loop body leads to 5.5x slower performance
@ 2011-10-10 22:45 alex.gaynor at gmail dot com
  2011-10-10 22:52 ` [Bug c/50693] " alex.gaynor at gmail dot com
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: alex.gaynor at gmail dot com @ 2011-10-10 22:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50693

             Bug #: 50693
           Summary: Slightly different loop body leads to 5.5x slower
                    performance
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: alex.gaynor@gmail.com


Created attachment 25460
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25460
Script which reproduces the speed difference.

Given the two loops in the attached file, the first generates excellent code,
which performs the same as a memset, however the second results in very poor
code which is 5.5x slower than the first. If anyone is curious why we have such
strange looking code: a compiler which targets C.

This was tested by compiling at -O3 with -std=gnu99 on my machine:


alex@alex-gaynor-laptop:/tmp$ gcc -O3 test.c -std=gnu99
alex@alex-gaynor-laptop:/tmp$ time ./a.out > /dev/null 

real    0m0.427s
user    0m0.412s
sys    0m0.016s
alex@alex-gaynor-laptop:/tmp$ time ./a.out > /dev/null 

real    0m0.428s
user    0m0.416s
sys    0m0.008s
alex@alex-gaynor-laptop:/tmp$ time ./a.out > /dev/null 

real    0m0.432s
user    0m0.404s
sys    0m0.024s
alex@alex-gaynor-laptop:/tmp$ 
alex@alex-gaynor-laptop:/tmp$ time ./a.out 0 > /dev/null 

real    0m2.225s
user    0m2.200s
sys    0m0.020s
alex@alex-gaynor-laptop:/tmp$ time ./a.out 0 > /dev/null 

real    0m2.217s
user    0m2.196s
sys    0m0.016s
alex@alex-gaynor-laptop:/tmp$ time ./a.out 0 > /dev/null 

real    0m2.268s
user    0m2.252s
sys    0m0.012s


^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2012-03-26 10:24 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-10 22:45 [Bug c/50693] New: Slightly different loop body leads to 5.5x slower performance alex.gaynor at gmail dot com
2011-10-10 22:52 ` [Bug c/50693] " alex.gaynor at gmail dot com
2011-10-10 22:54 ` [Bug tree-optimization/50693] Slightly different loop body leads not vectoring loop pinskia at gcc dot gnu.org
2011-10-10 22:55 ` pinskia at gcc dot gnu.org
2011-10-10 23:57 ` dje at gcc dot gnu.org
2011-10-11  0:04 ` dje at gcc dot gnu.org
2011-10-11  0:22 ` dje at gcc dot gnu.org
2011-10-11  0:23 ` pinskia at gcc dot gnu.org
2011-10-11  1:12 ` [Bug tree-optimization/50693] Loop optimization restricted by GOTOs dje at gcc dot gnu.org
2011-10-11  1:24 ` pinskia at gcc dot gnu.org
2011-10-11  1:35 ` dje at gcc dot gnu.org
2011-10-11  7:15 ` irar at il dot ibm.com
2011-10-11 14:07 ` dje at gcc dot gnu.org
2011-10-11 14:13 ` rguenth at gcc dot gnu.org
2011-10-11 14:15 ` paolo.carlini at oracle dot com
2011-10-11 14:35 ` rguenth at gcc dot gnu.org
2011-10-11 14:36 ` rguenth at gcc dot gnu.org
2011-10-11 14:40 ` dje at gcc dot gnu.org
2011-10-11 14:44 ` rguenth at gcc dot gnu.org
2011-10-11 14:46 ` rguenth at gcc dot gnu.org
2011-10-11 14:51 ` jakub at gcc dot gnu.org
2011-10-11 16:04 ` alex.gaynor at gmail dot com
2011-10-12 15:21 ` rguenth at gcc dot gnu.org
2011-10-25  4:48 ` aoliva at gcc dot gnu.org
2011-11-04 17:18 ` jakub at gcc dot gnu.org
2011-11-05 19:59 ` jakub at gcc dot gnu.org
2011-11-05 20:09 ` alex.gaynor at gmail dot com
2012-03-26 10:35 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).