On Tue, Dec 19, 2000 at 04:01:52PM -0800, David O'Brien wrote:
> On Mon, Dec 18, 2000 at 01:11:12PM -0600, Jacques A. Vidrine wrote:
> > /* Case 1 */ /* Case 2 */
> > if (data) vs. free(data)
> > free(data);
>
>
> Actually from an optimization standpoint, #1 can be worse (ie, harder on
> the processor). You've got a conditional jump there that is using branch
> prediction HW to track (which means there is some other conditional
> branch you're not, you're fetching both the taken and not take paths,
> etc... If the function call isn't expensive, #2 can be "faster".
There's more overhead than just the function call itself. For example,
our free() will do some locking & check for recursion beforing calling
another function that actually does the work.
--
Jacques Vidrine / [EMAIL PROTECTED] / [EMAIL PROTECTED] / [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message