Article View: comp.sys.mac
Article #38496Re: New Mac Rumours
From: Randy Buckland
Date: Tue, 28 Feb 1989 14:06
Date: Tue, 28 Feb 1989 14:06
31 lines
1271 bytes
1271 bytes
For general amusement, try looking at the generated code for the following
in LightSpeed C 3.0
strcpy (out, in)
char *out, *in;
{
while (*in)
*out++ = *in++;
}
as opposed to
strcpy (out, in)
char *out, *in;
{
while (*in)
{
*out = *in;
out++;
in++;
}
}
The first looks like it should be more efficient and would be on some machines
with the right compiler, However in LightSpeed C, the second is drastically
more efficient due to the order the operations are carried out in. It gets
even better if the pointers are optimised into registers or explicitly copied
into registers.
Randy Buckland
rcb@ncsuvx.ncsu.edu
Technical Details
Message-ID:
<2606@ncsuvx.ncsu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!xanth!mcnc!ncsuvx!cccvs1.ncsu.edu!rcbReferences:
<IY0io5y00UgPAM2b4a@andrew.cmu.edu> <41a2364a.a590@mag.engin.umich.edu> <70755@ti-csl.csc.ti.com> <41aa5eaa.a590@mag.engin.umich.edu> <15682@versatc.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!xanth!mcnc!ncsuvx!cccvs1.ncsu.edu!rcb From: rcb@cccvs1.ncsu.edu (Randy Buckland) Newsgroups: comp.sys.mac Subject: Re: New Mac Rumours Message-ID: <2606@ncsuvx.ncsu.edu> Date: 28 Feb 89 14:06:21 GMT References: <IY0io5y00UgPAM2b4a@andrew.cmu.edu> <41a2364a.a590@mag.engin.umich.edu> <70755@ti-csl.csc.ti.com> <41aa5eaa.a590@mag.engin.umich.edu> <15682@versatc.UUCP> Sender: news@ncsuvx.ncsu.edu Reply-To: rcb@cccvs1.ncsu.edu.UUCP (Randy Buckland) Organization: North Carolina State University Lines: 31