[PATCH] Improve talloc performance

Andrew Bartlett abartlet at samba.org
Sat Jun 18 05:47:55 UTC 2016

On Fri, 2016-06-17 at 17:12 -0700, Jeremy Allison wrote:

> I'm excited enough about the speed increase to finish
> rewriting this, as it looks great work !

Thanks for looking over it.  One of the big things that struck me in
talloc is that it is a core lib, used in every hot codepath, yet it has
a lot of extra features. 

What I mean is that adding unlikely() or likely() to a branch doesn't
make that call free.  Now, perhaps I'm not building with the right
magic, but I see a lot of CPU cost for these features.

What I mean is that we have the pool code (and I see how that can be
quite fast in the right circumstances), but also the talloc_memlimit
code, which is never used in Samba.  Both of these add overhead in the
talloc chunk, and add branches to the core routines.  We even have a
getenv() call in talloc_free()!  (This belongs in the library
constructor, now that we have one). 


Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list