From owner-freebsd-current@FreeBSD.ORG Wed Apr 23 07:09:32 2003 Return-Path: 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 24CF637B409; Wed, 23 Apr 2003 07:09:32 -0700 (PDT) Received: from HAL9000.homeunix.com (12-233-57-131.client.attbi.com [12.233.57.131]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF01F43FEC; Wed, 23 Apr 2003 07:09:28 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.5) with ESMTP id h3NE9RjC013429; Wed, 23 Apr 2003 07:09:27 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.5/Submit) id h3NE9MfS013428; Wed, 23 Apr 2003 07:09:22 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Wed, 23 Apr 2003 07:09:22 -0700 From: David Schultz To: Narvi Message-ID: <20030423140922.GB13246@HAL9000.homeunix.com> Mail-Followup-To: Narvi , Alex Semenyaka , freebsd-performance@freebsd.org, freebsd-current@freebsd.org References: <20030420011039.GC52081@snark.ratmir.ru> <20030422023703.G29990-100000@haldjas.folklore.ee> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030422023703.G29990-100000@haldjas.folklore.ee> cc: freebsd-performance@FreeBSD.ORG cc: freebsd-current@FreeBSD.ORG cc: Alex Semenyaka Subject: Re: /bin/sh and 32-bit arithmetics [CORRECTED] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Wed, 23 Apr 2003 14:09:32 -0000 On Tue, Apr 22, 2003, Narvi wrote: > > > 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... We're talking about interpreted Bourne shell here. It's slow by design, and 64-bit arithmetic is not going to make it significantly slower for anything other than microbenchmarks. BTW, I'll review the patches next month when I have some free time if nobody else jumps on it.