Path: utzoo!mnetor!uunet!husc6!mailrus!ames!pasteur!ucbvax!ernie.Berkeley.EDU!mjs
From: mjs@ernie.Berkeley.EDU (Marc J. Sabatella)
Newsgroups: comp.sys.ibm.pc
Subject: programs that run faster at 4.77 Mhz than at 10
Message-ID: <23988@ucbvax.BERKELEY.EDU>
Date: 8 May 88 18:44:56 GMT
Sender: usenet@ucbvax.BERKELEY.EDU
Reply-To: mjs@ernie.Berkeley.EDU (Marc J. Sabatella)
Organization: University of California, Berkeley
Lines: 30


As part of a project in a compiler class, I recently translated an assembly
language version of a lexical scanner for Ada into C, and was quite shocked
at some of the benchmark results I obtained.  On my 4.77/10 Mhz switchable
clone, the assembly language version of the program consistently runs
5-15% FASTER at 4.77 Mhz than at 10.  I am intimately familiar with the
source, and it doesn't do anything extraordinary with the timing.  It uses
the DOS block I/O functions to read in 32K chunks at a time; the inversion
is most pronounced when only one chunk is read (ie, the Ada source program
it is scanning is less the 32K), but exists one inputs as large as 5 MB.
The effect is more exaggerated on floppy than on hard disk, and less so
on ramdisk (but still occurs for small input files).  I tried it from floppy
disk on a friend's AT clone which also has a switchable clock rate, with
similar effect.
	The C language transliteration of the program exhibits the same
behavior for small input files (under 1MB or so).  The C language version
uses the same input routine.  I tried the experiment using the standard C
fgets() function (both in the assembly version and in the C version) from
the Turbo C library, as well as the Datalight C library, which do I/O in
much smaller chunks, and got the same results.

Can anyone offer a decent explanation of this? [Usually the speedup in clock
rate speeds up semi-I/O bound operations like compilers by about 50%, rather
than slow them down!]


----------------------                    ------------------------------
Marc Sabatella                            "I would prefer not to"
mjs@ernie.Berkeley.EDU                            Bartleby the Scrivener
----------------------                    ------------------------------