Re: malloc: speedup chunk housekeeping

2011-05-05 Thread Amit Kulkarni
The random number is derived from a global, which is incremented by a few bits every time a chunk is needed (with a small optimization if only one free slot is left). I have no feedback on this diff but a question on random placing in another two functions. In static void unmap()

Re: malloc: speedup chunk housekeeping

2011-05-05 Thread Amit Kulkarni
malloc_cache is a power of the, so a bitwise and with malloc_cache - 1 is equivalent to modulo malloc_cache. of two, that is. Room is reserved for MALLOC_MAXCACHE pointers, but only malloc_cache are ever used. So doing a modulo malloc_cache is ok. Ahh, sorry for that. I was thrown by that

Re: malloc: speedup chunk housekeeping

2011-05-04 Thread Otto Moerbeek
On Mon, May 02, 2011 at 10:09:29AM +0200, Otto Moerbeek wrote: Hi, Currently, malloc scans the bits of the chunk bitmap from position zero, skipping a random number (n) of free slots and then picking the next free one. This slows things down, especially if the number of full slots

Re: malloc: speedup chunk housekeeping

2011-05-04 Thread Stuart Henderson
On 2011/05/04 20:59, Otto Moerbeek wrote: Litle feedback so far. I'd like to move on with this, I have more goodies queued up. So get this on your machines! Done a make build and built about 150-odd ports on armish with it, also running it on my amd64 workstation. No problems noticed.

Re: malloc: speedup chunk housekeeping

2011-05-04 Thread Otto Moerbeek
On Wed, May 04, 2011 at 11:56:58PM -0500, Amit Kulkarni wrote: The random number is derived from a global, which is incremented by a few bits every time a chunk is needed (with a small optimization if only one free slot is left). I have no feedback on this diff but a question on

Re: malloc: speedup chunk housekeeping

2011-05-04 Thread Otto Moerbeek
On Thu, May 05, 2011 at 07:43:58AM +0200, Otto Moerbeek wrote: On Wed, May 04, 2011 at 11:56:58PM -0500, Amit Kulkarni wrote: The random number is derived from a global, which is incremented by a few bits every time a chunk is needed (with a small optimization if only one free slot is

malloc: speedup chunk housekeeping

2011-05-02 Thread Otto Moerbeek
Hi, Currently, malloc scans the bits of the chunk bitmap from position zero, skipping a random number (n) of free slots and then picking the next free one. This slows things down, especially if the number of full slots diminishes. This diff changes the scannning to start at a random position

Re: malloc: speedup chunk housekeeping

2011-05-02 Thread Otto Moerbeek
On Mon, May 02, 2011 at 10:09:29AM +0200, Otto Moerbeek wrote: Hi, Currently, malloc scans the bits of the chunk bitmap from position zero, skipping a random number (n) of free slots and then picking the next free one. This slows things down, especially if the number of full slots