VMS vs. UNIX file system

Scott Schwartz schwartz at shire
Mon Sep 19 05:23:35 AEST 1988


In article <3442 at crash.cts.com> jeh at 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 <stdio.h>
main()
{
	int c;	

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

/* f3.c: */

#include <stdio.h>
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 <test >foo
5.8u 0.7s 0:06 100% 0+224k 2+163io 0pf+0w

shire% time f3 <test >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 at 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"



More information about the Comp.unix.wizards mailing list