Received: from sgi.sgi.com (192.48.153.1) by cerious.com
 with SMTP (Apple Internet Mail Server 1.1.1); Wed, 12 Mar 1997 11:25:01 -0500
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by sgi.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via ESMTP id IAA07775; Wed, 12 Mar 1997 08:12:08 -0800
Received: (from daemon@localhost) by cthulhu.engr.sgi.com (950413.SGI.8.6.12/960327.SGI.AUTOCF) id OAA05991 for tiff-list; Wed, 12 Mar 1997 14:28:26 GMT
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37]) by cthulhu.engr.sgi.com (950413.SGI.8.6.12/960327.SGI.AUTOCF) via ESMTP id GAA05986 for <tiff-relay@relay.engr.sgi.com>; Wed, 12 Mar 1997 06:28:24 -0800
Received: from uu10.psi.com (uu10.psi.com [38.8.4.2]) by sgi.sgi.com (950413.SGI.8.6.12/950213.SGI.AUTOCF) via SMTP id GAA15830 for <tiff@sgi.com>; Wed, 12 Mar 1997 06:28:19 -0800
Received: by uu10.psi.com (5.65b/4.0.940727-PSI/PSINet) via UUCP;
        id AA21355 for ; Wed, 12 Mar 97 09:03:28 -0500
Received: from louie (louie.ARPA) by itek.com (4.1/3.2.083191-A.B.Dick/Itek Graphix)
	id AA11792; Wed, 12 Mar 97 08:41:53 EST
Message-Id: <9703121341.AA11792@itek.com>
X-Sender: wagner@itek1
X-Mailer: Windows Eudora Light Version 1.5.2
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Date: Wed, 12 Mar 1997 08:44:26 -0500
To: shabdv@aracnet.com
From: Scott Wagner <wagner@itek.com>
Subject: Re: Win32 Optimizations !!!
Cc: tiff@sgi.com
Sender: owner-tiff@relay.engr.SGI.COM
Precedence: bulk

Hello Shabd,

At 06:09 AM 3/11/97 -0000, you wrote:
>I have compiled the Sam'a fabulous tifflib for win32. Now I am trying to
optimize the code for both size and speed. Here are a couple of changes I
plan to make.
>1) Replace malloc family of functions with HeapAlloc family.

In applications which do not do repetitive dynamic memory
allocation/deallocation (this is the case with LibTiff) I have not seen
significant benefit from use of HeapAlloc over GlobalAlloc / LocalAlloc.
Win32 seems pretty good at establishing paging tables so that access to
these memory objects is efficient with either method.  Have you had
different results?  

The HeapAlloc family might help with the peculiarity noted in the following
comment extracted from tif_win32.c:

/* Memory allocation is handled in one of three ways, primarily because of a
problem with the Win32 API GlobalReAlloc() call.  The default behavior is to
use the compiler's ANSI malloc() family calls.  If WIN32_ALLOC is defined,
the WIN32 API functions are used, but GlobalReAlloc() is avoided by use of a
GlobalAlloc(new) - CopyMemory(old->new) - GlobalFree(old) sequence.  If
OLD_WIN32_REALLOC is defined (for backward compatibility), the
GlobalReAlloc() API is attempted.  THIS CAUSES MEMORY EXCEPTIONS IN SOME
CASES, AND IS NOT RECOMMENDED! */

>2) Replace  fwrite family of functions with ReadFile family.

fwrite is not used in tif_win32.c.  _tiffWriteProc and _tiffReadProc point
to WriteFile and ReadFile API functions.  Am I missing something here?

Regards,

Scott Wagner    (wagner@itek.com)
Staff Engineer
Itek Graphix
Rochester, NY USA

