Article View: comp.bugs.4bsd
Article #1129[n]eqn(1) speedup
From: Bernard Sieloff
Date: Sun, 07 Aug 1988 19:29
Date: Sun, 07 Aug 1988 19:29
57 lines
2006 bytes
2006 bytes
Subject: [n]eqn(1) speedup
Description:
This is no *real* bug, but it chews unnecessarily a lot of CPU time, if
you have some BIG [n]eqn input files.
Input to eqn with no effect to eqn itself will be passed unaltered to
stdout, but by calling printf()!
Eqn behavior is heavily sped up, if the "passing"-printf() calls are
changed to fputs() calls.
Fix:
Apply the following diff with Larry Wall's "patch" program.
The concerned file is io.c in eqn's source directory.
*** io.c.orig Sun Sep 4 00:19:07 1983
--- io.c Sun Aug 7 20:39:03 1988
***************
*** 32,38 ****
eqline = linect;
if (in[0]=='.' && in[1]=='E' && in[2]=='Q') {
for (i=11; i<100; used[i++]=0);
! printf("%s",in);
printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
markline = 0;
init();
--- 32,38 ----
eqline = linect;
if (in[0]=='.' && in[1]=='E' && in[2]=='Q') {
for (i=11; i<100; used[i++]=0);
! fputs(in, stdout); /* [bs] */
printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
markline = 0;
init();
***************
*** 58,64 ****
else if (type == lefteq)
inline();
else
! printf("%s",in);
}
return(0);
}
--- 58,64 ----
else if (type == lefteq)
inline();
else
! fputs(in, stdout); /* [bs] */
}
return(0);
}
--
Bernard Sieloff | UUCP: ...!uunet!unido!sbsvax!bs
Universitaet des Saarlandes | or bs@sbsvax.UUCP
FB 10 - Informatik (Dept. of CS) | CSNET: bs%sbsvax.uucp@Germany.CSnet
Bau 36, Im Stadtwald 15 | ARPA: bs%sbsvax.uucp@uunet.UU.NET
D-6600 Saarbruecken 11, W. Germany | Phone: +49 681 302 2434
Technical Details
Message-ID:
<583@sbsvax.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!sbsvax!bsShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!sbsvax!bs From: bs@sbsvax.UUCP (Bernard Sieloff) Newsgroups: comp.bugs.4bsd Subject: [n]eqn(1) speedup Keywords: [n]eqn munches too much CPU time Message-ID: <583@sbsvax.UUCP> Date: 7 Aug 88 19:29:19 GMT Organization: Universitaet des Saarlandes, Saarbruecken, West Germany Lines: 57