Xref: utzoo comp.os.vms:8750 comp.unix.wizards:11193
Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!psuvax1!shire!schwartz
From: schwartz@shire (Scott Schwartz)
Newsgroups: comp.os.vms,comp.unix.wizards
Subject: Re: VMS vs. UNIX file system
Summary: Is stdio the real problem?
Keywords: RMS, file system, stream files, stdio
Message-ID: <3951@psuvax1.cs.psu.edu>
Date: 18 Sep 88 19:23:35 GMT
References: <411@marob.MASA.COM> <178@arnold.UUCP> <3442@crash.cts.com>
Sender: news@psuvax1.cs.psu.edu
Reply-To: schwartz@shire.cs.psu.edu (Scott Schwartz)
Organization: Penn State University, department of Computer Science
Lines: 57

In article <3442@crash.cts.com> jeh@crash.CTS.COM (Jamie Hanrahan) writes:
|I offer this challenge:  Take a simple Unix filter like
|DETAB running on some Unix system on a VAX (Ultrix, BSD, AT&T, whatever).
|Rewrite it to use record-oriented I/O under VMS.  ...
|We've done this and the VMS/RMS versions run *at least* twice as fast, 
|sometimes five or six times.

I've seen unix programs (things like a grep replacement) that got
similar speedups by replacing stdio calls with read/write and a large
buffer.  I wonder how much of that 2-6x is from overhead in stdio,
rather than in the filesystem.  

Here is some sample data:

/* f1.c: */

#include 
main()
{
	int c;	

	while ((c = getchar()) != EOF)
		putchar(c);
}

/* f3.c: */

#include 
main()
{
	int len;	
	char buffer[BUFSIZ*10];

	while (len = read(0, buffer, sizeof(buffer)))
		write(1, buffer, len);
}

/* test file */

shire% wc test
26388  100728 1292508 test

/* results */

shire% time f1 foo
5.8u 0.7s 0:06 100% 0+224k 2+163io 0pf+0w

shire% time f3 foo
0.0u 1.0s 0:01 63% 0+248k 0+160io 0pf+0w

Shire is a Sun 4 running SunOS 4.0.  I got similar results on a Vax 780
running 4.3 BSD (except that it took 10 times longer to run.)

-- Scott Schwartz     schwartz@gondor.cs.psu.edu

Your array may be without head or tail, yet it will be proof against defeat.  
   Sun Tzu, "The Art of War"