Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 30813 invoked from network); 7 Feb 2007 21:06:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2007 21:06:26 -0000 Received: (qmail 54621 invoked by uid 500); 7 Feb 2007 21:06:33 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 54605 invoked by uid 500); 7 Feb 2007 21:06:33 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 54589 invoked by uid 99); 7 Feb 2007 21:06:33 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Feb 2007 13:06:33 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Feb 2007 13:06:25 -0800 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 8311E7142BF for ; Wed, 7 Feb 2007 13:06:05 -0800 (PST) Message-ID: <11833991.1170882365511.JavaMail.jira@brutus> Date: Wed, 7 Feb 2007 13:06:05 -0800 (PST) From: "Mark Brown (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Created: (STDCXX-335) std::min() suboptimal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org std::min() suboptimal --------------------- Key: STDCXX-335 URL: https://issues.apache.org/jira/browse/STDCXX-335 Project: C++ Standard Library Issue Type: Bug Components: 25. Algorithms Affects Versions: 4.1.3 Environment: gcc 3.2.3, x86 Linux Reporter: Mark Brown I don't know if it's the compiler that's generating worse code for the stdcxx version of min or if the function is not implemented as efficiently as it could be but the disassembly for the two functions below shows that my_min() is one instruction shorter than test_min(): #include int test_min (int x, int y) { return std::min (x, y); } int my_min (int x, int y) { return x < y ? x : y; } _Z8test_minii: pushl %ebp movl %esp, %ebp movl 12(%ebp), %eax cmpl %eax, 8(%ebp) jg .L2 leal 8(%ebp), %eax <<< extra load? .L4: movl (%eax), %eax leave ret _Z6my_minii: pushl %ebp movl %esp, %ebp movl 12(%ebp), %eax cmpl 8(%ebp), %eax jle .L6 movl 8(%ebp), %eax .L6: leave ret -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.