Threading libsmbclient - a proposal.

David Collier-Brown davecb at
Sat Apr 4 17:43:20 GMT 2009

Volker Lendecke wrote:
> On Sat, Apr 04, 2009 at 08:21:56AM -0400, Derrell Lipman wrote:
>> You may be right. I'm old. :-) Some habits instilled early in my career may
>> no longer be so necessary and I haven't researched it recently.
> I'm not 100% certain I'm right in that case. We'd need to
> test this. But I doubt it would make a difference
> significant enough to not use a function call.
> Volker
Premature optimization is the root of all evil(;-))

Seriously, though, it deserves a test. The call will definitely
cause an I-cache load, unless the callee was just used, so
a branch-around may be cheaper.

A side comment on the DEBUG macros:
You said:
>When I added the "unlikely" to the DEBUG macros, it actually made a
> difference when looking at our cache footprint with
> cachegrind. And that made a few percent difference for
> netbench.
I used samba as the example in a test of branch prediction many moons
ago, and discovered that there was enough code in a branched-around
DEBUG statement that I had a very high probability of hitting a different
I-cache line, which was thrashing my cache sufficiently that I couldn't
measure the speedup form the branch being predicted correctly.

Your experiment may argue for (further?) minimizing the footprint of the
debug macro in the caller, which I understand has already been looked at.


David Collier-Brown            | Always do right. This will gratify
Sun Microsystems, Toronto      | some people and astonish the rest
davecb at                 |                      -- Mark Twain
cell: (647) 833-9377, home (416) 223-8968, bridge (877) 385-4099 code 506 9191#

More information about the samba-technical mailing list