[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: New versions of openbsd_{basename,dirname}.c



Richard Braun, le Tue 17 Jan 2012 11:40:38 +0100, a écrit :
> On Tue, Jan 17, 2012 at 11:26:26AM +0100, Samuel Thibault wrote:
> > > I'd suggest using a base size of e.g. 64 or another power of two close
> > > to the expected common size, instead of "twice as much".
> > 
> > Why?
> 
> It should reduce fragmentation in most memory allocators

Why? Allocators often use header/footer around the allocated area, so a
power of two does nothelp.

> and it's also quicker to multiply.

?? "twice as much" is shifting left. Computing a close power of two is
way longer to compute.

Samuel


Reply to: