Don't burn 2k of stack on every iconv, use the heap when it's a slow call.
jra at samba.org
Thu Mar 31 10:52:59 MDT 2011
On Thu, Mar 31, 2011 at 03:33:31PM +1100, Andrew Bartlett wrote:
> I agree it's the slow path, but we hit it rather often (every umlaut
Well we could make this a static variable (yeah I know, globals :-)
and then initialize it once - maybe inside lazy_initialize_iconv() ?
> It just seemed like a really weird micro-optimisation. You couldn't
> just move the stack variable around?
Actually I wanted to use talloc_tos() but I see Volker has
already fixed that :-).
I could make the slow path a separate function and then use
the 2k of stack there I suppose. I don't think gcc is smart
enough to just allocate off the stack on entry to a sub-block,
and I wanted to avoid getting too deep a stackframe. The
less we use the better we'll be for embedded systems - this
just seemed like 2 pstrings to me :-).
More information about the samba-technical