[net.bugs.4bsd] vi speedup

corey@fluke.UUCP (Corey Satten) (02/28/84)

I have found a severe inefficiency in vi under 4.2BSD which causes
startup time to be substantially longer than pre-4.2 versions.  The
problem is in the code to source the .exrc file -- it does this using
one read system call per character of .exrc file.  Apparently the test
for whether to buffer the reads based on the results of the istty(0)
call is reversed.  If you read from a tty, it buffers, and if you read
from a file it does single byte reads.  Since we noticed no problems
reading from tty's with the test reversed I opted to eliminate the
test altogether.  To be safer, you can simply reverse it.

If you only have a binary license don't worry, use the EXINIT
environment variable instead of .exrc files and you will be fine.
That also prevents double sourcing of .exrc when you invoke vi from
your home directory.

My changes to ex_get.c follow:

diff old-ex_get.c new-ex_get.c
66c66
< 	static char inline[128];
---
> 	static char inline[BUFSIZ];
90c90
< 	if (intty) {
---
> 	{

                                *******
Corey Satten; John Fluke Mfg. Co MS 227E; PO Box C9090 Everett WA 98206
{uw-beaver,decvax!microsof,ucbvax!lbl-csam,allegra,ssc-vax}!fluke!corey
                             (206) 356-5058