Re: quick speedup in stmem.c

From: Duane Wessels <wessels@dont-contact.us>
Date: Thu, 6 Sep 2001 19:41:12 -0600 (MDT)

On Thu, 30 Aug 2001, Adrian Chadd wrote:

>
> Hi all,
>
> Whilst hacking away at stmem.c under the newhttp branch, I've noticed
> that the following is done:
>
> p = memAllocate(MEM_MEM_NODE);
> p->next = NULL;
> p->len = len_to_copy;
> p->data = memAllocate(MEM_STMEM_BUF);
> store_mem_size += SM_PAGE_SIZE;
>
> I've split this into a little routine since I'm using it in multiple
> places, but then I wondered - why not just declare the node data as
> a static array of SM_PAGE_SIZE rather than a pointer?
>
> That'll save one pointer per stmem mem_node (which results in at least
> a _little_ savings), but it'll drop one alloc and one dealloc per
> new stmem node. The latter is what I'm chasing - dropping the number
> of allocs/frees will save CPU time.
>
> Have I missed anything here? I'm starting to get on the train of
> cutting down the number of allocs, after trying to abuse mempools
> for chunks of structs (eg the StoreEntry repl_policy stuff), and this
> might be a cheap optimisation for 2.4 and HEAD.

sounds reasonable to me.
Received on Thu Sep 06 2001 - 19:41:14 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:20 MST