UNIX vs. VMS - SYSTEM FUNCTIONS

Guy Harris guy at auspex.UUCP
Wed Oct 26 03:29:23 AEST 1988


>I have been timing the relative differences between the speeds
>of the functions "strlen" and "strcpy" as executed on UNIX
>and VMS.  Why is one system so much faster?  Is it just the machine
>mips that accounts for the differences?

Partially, but probably not entirely.

>VMS - We are running vms 4.7 with version 2.3 of the C compiler
>on a Vaxstation 2000. 
>UNIX - We are running Sun 3.5 (UNIX BSD 4.2) on a 3/280 set up
>as a multi-user system with 14 users connected via a multiplexor.

The 3/280 has a 25MhZ zero-wait-state (unless you get a cache miss....)
68020, which may well be faster than a VAXStation 2000 (is the 2000
about equal to a 780?  If so, the 3/280 has a much faster CPU - about 4x
faster...).

However, there is another issue.  C strings are zero-terminated, not
counted.  VAX string instructions don't, as I remember, know about zero
terminator bytes (unless you use "movtuc", but that adds extra overhead
for table lookup).  The 4.3BSD (and, I think, S5) VAX version of
"strcpy" first does a "locc" to find the null terminator, and then a
"movc3" to copy the string.  This requires two passes over the string. 

The 68K, however, isn't "helped" by having those string instructions, so
the 68K assembler-language version searches for the zero terminator
while it copies, so it only makes one pass over the string.  The loop
fits into the on-chip instruction cache on the 68020, so it runs fairly fast.



More information about the Comp.unix.questions mailing list