Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery016.isp.belgacom.be (Postfix) with ESMTP id 5DFB3558041
	for <joris.at.lebbeke@skynet.be>; Tue, 17 Jul 2007 15:23:11 +0200 (CEST)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 17 Jul 2007 15:23:10 +0200
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l6HBwdl4007664;
	Tue, 17 Jul 2007 07:59:47 -0400
Received: from homer.shelbyville.oz
	(ppp121-45-10-193.lns10.adl2.internode.on.net [121.45.10.193])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id l6HBwaak007661
	for <tiff@lists.maptools.org>; Tue, 17 Jul 2007 07:58:37 -0400
Received: from ron by homer.shelbyville.oz with local (Exim 4.67)
	(envelope-from <ron@debian.org>) id 1IAltB-00078A-EF
	for tiff@lists.maptools.org; Tue, 17 Jul 2007 21:40:49 +0930
Date: Tue, 17 Jul 2007 21:40:49 +0930
From: Ron <ron@debian.org>
To: tiff@lists.maptools.org
Subject: Re: [Tiff] Re: Bit shifting and rotating of TIFF images
Message-ID: <20070717121049.GA17202@homer.shelbyville.oz>
References: <200707121602.l6CG2nQD030934@duke.maptools.org>
	<4697A62D.5010202@qwest.net>
	<77A3A9AB-2B56-4969-8D54-F4D96747B190@kreisbote.de>
	<Pine.SOC.4.60.0707141053390.922@blade.simplesystems.org>
	<CAEEC41F-F54C-41DE-8DC0-32642504A899@kreisbote.de>
	<Pine.SOC.4.60.0707161008140.922@blade.simplesystems.org>
	<880AA52E-C446-40CD-854D-708F0788A745@kreisbote.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <880AA52E-C446-40CD-854D-708F0788A745@kreisbote.de>
User-Agent: Mutt/1.5.16 (2007-06-11)
X-SA-Exim-Connect-IP: <locally generated>
X-SA-Exim-Mail-From: ron@debian.org
X-SA-Exim-Scanned: No (on homer.shelbyville.oz);
	SAEximRunCond expanded to false
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.0000264b
X-MSP-STORE: Tue, 17 Jul 2007 15:23:11 +0200
Status:   

On Tue, Jul 17, 2007 at 11:32:35AM +0200, Oliver Geisen wrote:
>>> Simulated image of 16300x27501 pixels, bilevel:
>>>
>>> Results:
>>>  * plain reading/writing (no bit-manipulation): 0.294 sec
>>>  * using bit-shift operator ("<<" resp. ">>"):  1.920 sec
>>>  * using lookup-table:                          0.380 sec
>>
>> That is interesting.  It seems that you are right that for the CPU you are 
>> using the lookup-table approach is much faster.  Maybe it is always 
>> faster.
> I think this is true for images beyond a specific size (number of pixels).

I suspect you'll find the size (and perhaps even layout) of your
lookup table is a significant factor.  Along with the data you
look up in it.  If the entries you need don't fit in the cache
that's when the performance penalties kick in.

Also if your algorithmic method isn't the best it can be, and
not coded in hand optimised (or at least audited) assembler,
then what you are comparing may not be a 'fair' contest.

I know of at least one fairly recent benchmark where an algorithmic
method supposedly beats a lookup table, but its implementation also
relies on fast bit manipulations that are available to the processor,
but not exposed to people coding in C.

Since your current results are only about 25% slower than a raw copy,
whether its worth pursuing that really depends on how big a number
you are adding 25% to ;-)  ... and whether your performance figures
really do stay around this level with varying input data.

Cheers,
Ron


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
