On 5 March 2013 11:55, Mark Kettenis <mark.kette...@xs4all.nl> wrote:
>> Date: Tue, 5 Mar 2013 11:36:36 +0100
>> From: Martin Pieuchot <mpieuc...@nolizard.org>
>>
>> The ifaddr structure contains a reference counter and two different way
>> to check it before freeing its memory: a macro IFAFREE(), and a function
>> ifafree().
>> Because the former calls the latter when the reference counter is null,
>> and then also check for the reference counter, I see no point in keeping
>> two ways to do the same thing.
>
> Well, the point is probably that by doing the refcount check in the
> macro you avoid a function call in most cases.  It's very well
> possible that this is a case of premature optimization.  Almost
> certainly the case unless the macro is called in a
> performance-critical path.  If it is called in a performance-critical
> path, some benchmarking should probably be done to make sure this
> doesn't impact something like packet forwarding performance in a
> negative way.
>

to be fair, there are millions of these function calls. i highly
doubt one can measure any performance difference -- it'll all be
within error margin.

Reply via email to