[prev in list] [next in list] [prev in thread] [next in thread] 

List:       krbdev
Subject:    Re: DAL cleanup project proposal
From:       Greg Hudson <ghudson () MIT ! EDU>
Date:       2010-07-04 18:29:12
Message-ID: 1278268152.28234.277.camel () ray
[Download RAW message or body]

On Sun, 2010-07-04 at 13:58 -0400, Simo Sorce wrote:
> Does this means we can potentially have more allocations when
> enumerating principals ?
> Passing down a buffer allows you to reuse the same one over and over
> with out any allocation if you want to.
> Of course if the code was already allocating a buffer before each
> get_principal call the point is moot.

Filling in a caller-allocated container is slightly more efficient (the
caller can stack-allocate the container, for instance, and in this case
usually does).  But avoiding one allocation is a pretty tiny
optimization relative to what goes on in a database lookup.

Overall in krb5, we have a mix of caller-allocates-container and
API-allocates-container, presumably because some developers have valued
the small efficiency benefits of the first approach and others have
valued the simpler semantics of the second approach.  Unfortunately,
having a mix makes our APIs harder to understand.  I would like libkdb5
to be consistent about caller vs. API container allocation for principal
and policy lookups.


_______________________________________________
krbdev mailing list             krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic