From owner-freebsd-current@FreeBSD.ORG Sun Jun 5 00:56:03 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AA9616A41C for ; Sun, 5 Jun 2005 00:56:03 +0000 (GMT) (envelope-from nakal@nurfuerspam.de) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 809AF43D49 for ; Sun, 5 Jun 2005 00:56:02 +0000 (GMT) (envelope-from nakal@nurfuerspam.de) Received: (qmail invoked by alias); 05 Jun 2005 00:56:00 -0000 Received: from p5090FB26.dip.t-dialin.net (EHLO klotz.local) [80.144.251.38] by mail.gmx.net (mp025) with SMTP; 05 Jun 2005 02:56:00 +0200 X-Authenticated: #989277 Received: from [127.0.0.1] (localhost [127.0.0.1]) by klotz.local (8.13.3/8.13.3) with ESMTP id j5509rqF005157 for ; Sun, 5 Jun 2005 02:09:54 +0200 (CEST) (envelope-from nakal@nurfuerspam.de) Message-ID: <42A242D1.4000002@nurfuerspam.de> Date: Sun, 05 Jun 2005 02:09:53 +0200 From: Martin User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050403) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-current@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Optimizing libc/string for amd64(?) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jun 2005 00:56:03 -0000 Hello, I ran nbench on different workstations and noticed that amd64-platform is really bad when doing "STRINGSORT". Sempron 2200+ (i386) : 88 iterations/second Athlon64 3000+ (amd64): 32.15 iterations/second I looked inside nbench and it seems to call memmove very often. This is OK, in my opinion, so I investigated further. I've just looked inside libc how memmove/memcpy is handled there. The function is inside bcopy.c. I noticed that the "word" which is used for copying has the size of "int". Wouldn't it be better to set it to "typedef long word"? OpenBSD is using "long" there, for example, as I noticed later. I don't have amd64 at home, so I cannot really test everything out. Can someone of you take a look at the code in libc/string? There are various places that are using "int" instead of "long", e.g. also in memset-code. Can anyone confirm this bad performance with STRINGSORT on amd64? Martin