From owner-freebsd-questions@FreeBSD.ORG Wed Feb 18 21:06:59 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F58B106564A for ; Wed, 18 Feb 2009 21:06:59 +0000 (UTC) (envelope-from kailash.kailash@zscaler.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.231]) by mx1.freebsd.org (Postfix) with ESMTP id 28BC78FC08 for ; Wed, 18 Feb 2009 21:06:59 +0000 (UTC) (envelope-from kailash.kailash@zscaler.com) Received: by rv-out-0506.google.com with SMTP id f6so105942rvb.43 for ; Wed, 18 Feb 2009 13:06:58 -0800 (PST) Received: by 10.142.156.2 with SMTP id d2mr81445wfe.179.1234989911517; Wed, 18 Feb 2009 12:45:11 -0800 (PST) Received: from KAILASH2007 (75-101-82-128.static.dsltransport.net [75.101.82.128]) by mx.google.com with ESMTPS id 20sm501190wfi.32.2009.02.18.12.45.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Feb 2009 12:45:11 -0800 (PST) From: "Kailash Kailash" To: Date: Wed, 18 Feb 2009 12:44:53 -0800 Message-ID: <499c7357.14098e0a.1394.ffffda2d@mx.google.com> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcmSCb/gLbaVuzwAS4OLrjjjVrRf0A== Content-Language: en-us Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: FreeBSD 7.O compiled code is very slow X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Feb 2009 21:06:59 -0000 I am using FreeBSD 7.0 in 64 BIT mode. Same code compiled on BSD 7.0 runs 50% speed (as expected by CPU and code architecture) compared to BSD 6.2. Here is one real code with binary output. On 3.0 GHz Woodcrest processor, I am able to copy from one cache to another cache at the speed of 24Gbytes/second verses 12 Gbytes/second. Any help is appreciated. Thanks, Kailash Source-code: #define BACKWARD_MEMCOPY_WITH_TYPE(dp, sp, len, type) BACKWARD_MEMCOPY((type*)(dp), (const type*)(sp), ((len)+(sizeof(type)-1))/sizeof(type)) #define BACKWARD_MEMCOPY(dp, sp, len) \ do { \ smwbits __len = len; /* must be signed value */ \ while (--__len >= 0) \ (dp)[__len] = (sp)[__len]; \ } while (0) BSD 6.2 code 0x00000000004353b2 : mov 0x8(%rbp,%rdx,8),%rax 0x00000000004353b7 : mov %rax,0x48(%r12,%rdx,8) 0x00000000004353bc : dec %rdx 0x00000000004353bf : jns 0x4353b2 BSD 7.0 code 0x000000000040cb80 : mov 0xfffffffffffffff8(%rsi),%rax 0x000000000040cb84 : mov %rax,0xfffffffffffffff8(%rcx) 0x000000000040cb88 : sub $0x8,%rsi 0x000000000040cb8c : sub $0x8,%rcx 0x000000000040cb90 : sub $0x1,%rdx 0x000000000040cb94 : jns 0x40cb80