Nikos Mavrogiannopoulos <[email protected]> writes: > On Fri, Sep 7, 2012 at 4:29 PM, Nikos Mavrogiannopoulos <[email protected]> > wrote: > >> Btw. I noticed that samba's talloc has a talloc using a pool. Using >> that in libtasn1 could have the following immediate effects: >> * No memory leaks once a structure is deallocated >> * A single malloc (or at least fewer) per structure >> In general talloc() should be a bit slower than plain malloc, but I >> believe that pooled version could have an impact in this case. I'll >> try to test it this or next weekend. > > It seems that talloc either with pools or not is much slower than the > current code. However, a quick optimization that reduced that > allocations by almost a third (2000 allocations for a certificate > instead of 3000), is to make the node name a fixed string. This also > increased the performance of the library in decoding by almost 20%. > However, I've noticed that for some reason the node_asn structure is > exported in libtasn1.h, something that doesn't prevents to make this > change (at least directly). This is quite surprizing as this structure > was definitely not intended to be exported. Given that this node_asn > isn't documented anywhere, are there actually any projects using it? > If yes, why is that - can we emulate the use case with a new function? > I think future versions of libtasn1 should drop this structure from > the exported API to allow the library to be rewritten and keep the > same API.
I agree -- and considered doing this when we did the 'small_value' (see int.h) change that we did earlier. However, I think actually GnuTLS was one consumer of the node_asn_struct... I think it was only in some X.509 Name functions contributed by Howard Chu, so perhaps we can rewrite only those parts. With that fixed, I think we could roll a libtasn1 3.x branch that removed the struct, and move on from there... that would allow a rewrite of the internal tree stuff without breaking API/ABI. /Simon
