From owner-freebsd-performance@FreeBSD.ORG Mon Apr 21 16:39:54 2003 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 56D6C37B401; Mon, 21 Apr 2003 16:39:54 -0700 (PDT) Received: from haldjas.folklore.ee (Haldjas.folklore.ee [193.40.6.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2153843FBD; Mon, 21 Apr 2003 16:39:52 -0700 (PDT) (envelope-from narvi@haldjas.folklore.ee) Received: from haldjas.folklore.ee (localhost [127.0.0.1]) by haldjas.folklore.ee (8.12.3/8.11.3) with ESMTP id h3LNdoUE031404; Tue, 22 Apr 2003 02:39:51 +0300 (EEST) (envelope-from narvi@haldjas.folklore.ee) Received: from localhost (narvi@localhost)h3LNdo57031401; Tue, 22 Apr 2003 02:39:50 +0300 (EEST) Date: Tue, 22 Apr 2003 02:39:50 +0300 (EEST) From: Narvi To: Alex Semenyaka In-Reply-To: <20030420011039.GC52081@snark.ratmir.ru> Message-ID: <20030422023703.G29990-100000@haldjas.folklore.ee> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Mailman-Approved-At: Mon, 21 Apr 2003 16:43:50 -0700 cc: freebsd-hackers@freebsd.org cc: freebsd-performance@freebsd.org cc: freebsd-current@freebsd.org Subject: Re: /bin/sh and 32-bit arithmetics [CORRECTED] X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Apr 2003 23:39:54 -0000 On Sun, 20 Apr 2003, Alex Semenyaka wrote: > 7 5.20 6.37 3.51 22.50% i=$(($i<<1)) > 8 5.25 6.42 3.51 22.27% i=$(($i<<$m)) > > As you can see, even for arithmetic-only script the overhead is not too big > except with one case: shift operation. I decided to investigate is it usual > script operation. I've went through all scripts I could find in my FreeBSD > box. I've searched them with "locate .sh | grep '\.sh$'". There were a lot > of them: > > $ locate .sh | grep '\.sh$' | wc -l > 1637 > > But there was no any script that uses the shift operation. Good, but not > enough. I've take the script that uses arithmetics and do some other job, > ttfadmin.sh from the Abiword package. I've run in 10000 times in the loop > with both (64-bit and 32-bit) shells. As an argument it received empty > directory so no work has been done, just run, check pars, found no files, > exit. It takes 65.35 seconds in the first case and 65.30 second in the second > one. So the the time that arithmetics takes during the real script execution > is too small in comparison to total running time (obviously: arithmetics > is in-core calculations while any script usually run some external programs > etc, and at least I/O is involved). Ahem - wouldn't it be easier to find out *why* the dramatic speed-down happens and trying to combat it as opposed to trying to show the speed-down is not releavant? There shouldn't be anything inherently that much slower in 64 bit shifts... > > Thanks! > > SY, Alex >