By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,421 Members | 1,089 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,421 IT Pros & Developers. It's quick & easy.

speed and passing data

P: n/a
Hi all,

Is there a performance issue when passing data types of different sizes to
a function? For example, if a double precision variable is bigger than a
single precision variable, is it faster at run time to pass the single
precision variable? Let's say the function does the exact same thing in
both cases (say, returns an integer). Is this a compiler-specific issue,
or is there a rule of thumb applicable to C?

N

--
Nov 14 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
N Yiannakoulias <nw*@srv.ualberta.ca> writes:
Is there a performance issue when passing data types of different sizes to
a function? For example, if a double precision variable is bigger than a
single precision variable, is it faster at run time to pass the single
precision variable? Let's say the function does the exact same thing in
both cases (say, returns an integer). Is this a compiler-specific issue,
or is there a rule of thumb applicable to C?


The answer is going to depend on the compiler and the
architecture and everything else. For instance, on x86
floating-point values are sometimes passed in the CPU's
floating-point registers; in that case, it shouldn't matter
whether they are float or double or long double.

The only way you can find out for sure is to measure actual
performance on the system of interest.
--
"The expression isn't unclear *at all* and only an expert could actually
have doubts about it"
--Dan Pop
Nov 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.