public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "alex.gaynor at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/50693] New: Slightly different loop body leads to 5.5x slower performance Date: Mon, 10 Oct 2011 22:45:00 -0000 [thread overview] Message-ID: <bug-50693-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2011-10-10 22:45 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-10-10 22:45 alex.gaynor at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-50693-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).