From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13223 invoked by alias); 28 Aug 2005 23:25:29 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 13208 invoked by uid 48); 28 Aug 2005 23:25:29 -0000 Date: Sun, 28 Aug 2005 23:25:00 -0000 Message-ID: <20050828232529.13206.qmail@sourceware.org> From: "greenrd at greenrd dot org" To: java-prs@gcc.gnu.org In-Reply-To: <20050820162349.23495.greenrd@greenrd.org> References: <20050820162349.23495.greenrd@greenrd.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libgcj/23495] java.lang.String.equals is suboptimal X-Bugzilla-Reason: CC X-SW-Source: 2005-q3/txt/msg00441.txt.bz2 List-Id: ------- Additional Comments From greenrd at greenrd dot org 2005-08-28 23:25 ------- memcmp (which is compiled for i686 in fedora because it is part of glibc) is actually less efficient than the current code on my athlon! I was so surprised, I ran the memcmp benchmark again, and the results differed by no more than +/-2%. Here are the wallclock times in ms, followed by the advantage of block compare over the current code. n is the length of the strings tested. n | Current | block compare | memcmp | Advantage of block compare ------------------------------------------------------------------- 10 | 10717 | 9236 | 11957 | 16% 30 | 16427 | 14618 | 19884 | 12% 50 | 22181 | 17539 | 27550 | 26% 70 | 28052 | 20978 | 35243 | 34% 90 | 32966 | 24695 | 42815 | 33% 110 | 42975 | 28453 | 55036 | 51% All these tests were done on x86 with the same -O, -g and -f flags as make bootstrap uses by default, using LD_PRELOAD to "hot-replace" the code, and without the assertion enabled in the benchmark. The advantage of block compare rises to 54% for n=10 and 81% for n=110 if -march=athlon-xp is used (to compile both the original code and my block compare code). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23495