Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 alpha 4/15/85; site elsie.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!elsie!ado
From: ado@elsie.UUCP (Arthur David Olson)
Newsgroups: net.bugs.4bsd
Subject: Re: /lib/c2 optimizes calls instructions
Message-ID: <5207@elsie.UUCP>
Date: Thu, 22-Aug-85 11:22:21 EDT
Article-I.D.: elsie.5207
Posted: Thu Aug 22 11:22:21 1985
Date-Received: Sat, 24-Aug-85 18:42:19 EDT
References: <2064@ukma.UUCP> <1326@umcp-cs.UUCP>
Organization: NIH-LEC, Bethesda, MD
Lines: 79
Summary: Is "calls r*,_subr" truly faster than "call $*,_subr"?
> >Index: /lib/c2, BRL-Unix release 3, likely appears in other 4.?BSD.
> >Problem: Calls instructions have a format "calls ,".
> > The argument will sometimes be "optimized" into
> > a register reference. This isn't necessary. . .
>
> It saves a little teensy bit of time. . .
Hmmm. . .let's check this out with the following program on a VAX 11/750
(4.1bsd, cp_urev = 94, cp_hrev = 72):
main(argc, argv)
int argc;
char * argv[];
{
register int i;
i = atoi(argv[1]);
do {
one();
two();
} while (--i > 0);
}
dummy1() { dummy1(); dummy1(); dummy1(); dummy1(); dummy1(); }
one()
{
register int i, j;
i = 1000;
do {
j = 0;
subr();
} while (--i > 0);
}
dummy2() { dummy2(); dummy2(); dummy2(); dummy2(); dummy2(); }
two()
{
register int i, j;
i = 1000;
do {
subr();
j = 0;
} while (--i > 0);
}
dummy3() { dummy3(); dummy3(); dummy3(); dummy3(); dummy3(); }
subr() {}
If I name the above "try.c" and
cc -c -O try.c ; cc -p -O try.o ; a.out 10000 ; prof
I get this output:
%time cumsecs #call ms/call name
60.8 325.10 _subr
20.2 433.28 _one
18.9 534.22 _two
0.1 534.73 _main
which says that the function "one", with its
L33:clrl r10
calls r10,_subr
sobgtr r11,L33
takes more time than function "two", with its
L46:calls $0,_subr
clrl r10
sobgtr r11,L46
loop.
Comments?
--
Bugs is a Warner Brothers trademark.
UNIX is an AT&T Bell Laboratories trademark.
BRL is a Bethesda Research Laboratories trademark.
--
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA
DEC, VAX and Elsie are Digital Equipment and Borden trademarks