[SCM] Samba Shared Repository - branch master updated

Volker Lendecke Volker.Lendecke at SerNet.DE
Wed May 30 08:36:17 MDT 2012


On Wed, May 30, 2012 at 04:31:43PM +0200, Kai Blin wrote:
> 
> >> I still disagree with the claim that the fact a macro called
> >> "NT_STATUS_NOT_OK_RETURN" changes control flow is a surprise,
> > 
> > Yes agreed, but the benefit to readability that the extra ~2 lines of
> > code added is worth it IMO. Conditional cleanup and gotos make such
> > macros even worse.
> 
> After playing a little with macros for my editor, I'm actually starting
> to agree. The code _is_ more obvious, and a simple one-liner in my
> editor's config file takes care of the boilerplate. So I retract my
> objection.
> 
> Does anybody know if the unlikely() condition on the macros has a huge
> performance impact?
> 
> if (unlikely(!foo)) {
> 	return NT_STATUS_NO_MEMORY;
> }

In tight loops or core code like talloc it does. The main
effect I've seen is that the "unlikely" case is moved out of
the main code path. This leads to less cache footprint.
That's the main reason why it was put into the DEBUG macros
once upon a time (not sure it's still in there).

For relatively rarely executed code I don't think it really
matters.

With best regards,

Volker Lendecke

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de


More information about the samba-technical mailing list