This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: alloca vs malloc

On Mon, May 19, 2014 at 09:58:31AM +0530, Siddhesh Poyarekar wrote:
> On Sat, May 17, 2014 at 12:07:54AM +0000, Joseph S. Myers wrote:
> > On Sat, 17 May 2014, Ondrej Bilka wrote:
> > 
> > > For libc there are better alternatives, I will add priority to malloca
> > > cleanup. As glibc code is now alloca are mostly
> > > trivial or following this pattern occuring about hundred times:
> > 
> > I suggest doing such cleanup in a maximally conservative and incremental 
> > way:
> One straightforward set of changes in this area would be to replace
> the alloca+extend_alloca usage in getaddrinfo code with straight
> malloc+free.  I doubt if the performance improvement due to using
> alloca is in any way noticeable in those functions given that the
> major costs there would be file or network I/O.
I will replace it everywhere. It does not improve performance for simple
reason that it is called after function returned insufficient space then
even if first buffer was 4096 bytes and its speed was cycle per byte you
already spent 4096 cycles.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]