Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-k.one.com (mx-k.one.com [91.198.169.58])
	by mail6.b-one.net (Postfix) with ESMTP id 91A2E8015007B
	for <filtered@awaresystems.be>; Fri,  7 Sep 2012 13:34:15 +0200 (CEST)
X-Virus-Scanned: by one.com
Received-SPF: pass (mx-k: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.212.48 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-vb0-f48.google.com (mail-vb0-f48.google.com [209.85.212.48])
	by mx-k.one.com (Postfix) with ESMTP id F0372ADA8C8
	for <filtered@awaresystems.be>; Fri,  7 Sep 2012 11:34:11 +0000 (UTC)
Received: by vbme21 with SMTP id e21so4084909vbm.21
        for <filtered@awaresystems.be>; Fri, 07 Sep 2012 04:34:11 -0700 (PDT)
Received: by 10.221.2.2 with SMTP id ns2mr6633850vcb.74.1347017651276;
        Fri, 07 Sep 2012 04:34:11 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.58.70.138 with SMTP id m10csp396369veu;
        Fri, 7 Sep 2012 04:34:10 -0700 (PDT)
Received: by 10.52.26.104 with SMTP id k8mr5444032vdg.79.1347017650145;
        Fri, 07 Sep 2012 04:34:10 -0700 (PDT)
Received-SPF: neutral (google.com: 91.198.169.57 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=91.198.169.57;
Received: by 10.230.170.23 with POP3 id b23mf1008996vbz.5;
        Fri, 07 Sep 2012 04:34:09 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.one.com (mx-j.one.com [91.198.169.57])
	by mail6.b-one.net (Postfix) with ESMTP id 3CB1A8015007B
	for <info@awaresystems.be>; Fri,  7 Sep 2012 13:27:46 +0200 (CEST)
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-j.one.com (Postfix) with ESMTP id D2785102ADD
	for <info@awaresystems.be>; Fri,  7 Sep 2012 11:27:45 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 0A66743A3F1;
	Fri,  7 Sep 2012 06:26:39 -0500 (EST)
Received: from mail-iy0-f172.google.com (mail-iy0-f172.google.com
	[209.85.210.172])
	by lists.maptools.org (Postfix) with ESMTPS id CC40743A3EB
	for <tiff@lists.maptools.org>; Fri,  7 Sep 2012 06:25:55 -0500 (EST)
Received: by iabz21 with SMTP id z21so3044692iab.3
	for <tiff@lists.maptools.org>; Fri, 07 Sep 2012 04:25:56 -0700 (PDT)
Received: by 10.42.60.139 with SMTP id q11mr6465449ich.53.1347017156057; Fri,
	07 Sep 2012 04:25:56 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.231.180.5 with HTTP; Fri, 7 Sep 2012 04:25:14 -0700 (PDT)
In-Reply-To: <6CCDD8FC6578314C902BBF87D511D9D826732523@EXCHMBX01.fed.cclrc.ac.uk>
References: <6CCDD8FC6578314C902BBF87D511D9D8267301D4@EXCHMBX01.fed.cclrc.ac.uk>
	<CAGNS0Rv+MbyVoFcVXr0Wwcom0FMMyssAAnciybvG_dRpnpqhHw@mail.gmail.com>
	<6CCDD8FC6578314C902BBF87D511D9D826732523@EXCHMBX01.fed.cclrc.ac.uk>
From: jcupitt@gmail.com
Date: Fri, 7 Sep 2012 12:25:14 +0100
Message-ID: <CAGNS0RskeYaTuf7b4_mBbDAFQN3yRdcNuGPb=NM3jrr_0w-qpw@mail.gmail.com>
To: Robert.Atwood@diamond.ac.uk
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] Managing the buffer
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
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>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Hi again Robert,

On 7 September 2012 10:21,  <Robert.Atwood@diamond.ac.uk> wrote:
> But as an aside .. Is it any faster to use TIFFWriteEncodedStrip and manage the strips? My predecessor did it that way but I don't agree. I understand that TIFFLib is usually clever enough to manage strips in memory as the scanlines are added, at least it seems to work very well using exactly the sequence you describe in my other programs using TIFFlib. I expect it is not any slower or faster, just the code is more complicated managing each strip. I haven't tried a comparison though.

You're right (in my experience). I imagine writing a scanline at a
time will cause an extra copy operation as the strip buffer is filled,
but that should be an almost invisible overhead. Here's tiff scanline
write vs. calling unix write() repeatedly:

$ time vips black wtc.tif 20000 20000
real	0m4.926s
user	0m0.712s
sys	0m0.800s
$ time vips black wtc.v 20000 20000
real	0m4.705s
user	0m0.400s
sys	0m0.812s

So calling write() directly is about 0.3s less CPU time for a 400MB
image on my terrible old desktop PC.

> I'm sorry, but you misunderstand. I wish to ensure that TIFFOpen is  not allocating its own buffer repeatedly. I was not asking about how to manage my program's image array.

Ah yes, sorry you're right. That buffer isn't going to be large
though, if you're that short of memory you are in terrible trouble
anyway. Pre-allocating the tiff write buffer will only get you a very
marginal increase in your ability to buffer images being queued for
transfer to disc at the cost of some annoying hackery. I wonder if
it's worth the trouble.

Would it be easier to add more memory or to boost the disc write speed
or somehow throttle image capture? I guess there's some reason this
isn't possible.

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