Re: Does Casting Slow a Program Down?
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Wed, 31 Jan 2007 15:05:11 +0000
PeterOut said:
If I had code like this.
unsigned short usLimit=10
int a[10], i;
for (i=0; i<(int)usLimit; ++i)
{
a[i]=(int)usLimit;
}
would it run slower than this?
int a[10], i, iLimit=10;
for (i=0; i<iLimit; ++i)
{
a[i]=iLimit;
}
To find out, code both versions, put them in separate functions, and call
them each a zillion times. Then check the profiler's output.
Repeat on each relevant implementation. (Don't expect A to be faster than B
on implementation Y just because it was faster on implementation X.)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
.
- References:
- Does Casting Slow a Program Down?
- From: PeterOut
- Does Casting Slow a Program Down?
- Prev by Date: Re: Does Casting Slow a Program Down?
- Next by Date: Re: Does Casting Slow a Program Down?
- Previous by thread: Re: Does Casting Slow a Program Down?
- Next by thread: Re: Does Casting Slow a Program Down?
- Index(es):
Relevant Pages
|