You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Brian Pane <bp...@pacbell.net> on 2001/11/22 10:03:42 UTC
[PATCH] optimization for apr_pool_userdata_set
This patch takes advantage of the recent optimizations to
apr_hash_t's handling of APR_HASH_KEY_STRING to eliminate
a strlen call within apr_pool_userdata_set.
--Brian
Index: srclib/apr/memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvspublic/apr/memory/unix/apr_pools.c,v
retrieving revision 1.116
diff -u -r1.116 apr_pools.c
--- srclib/apr/memory/unix/apr_pools.c 2001/11/21 16:40:54 1.116
+++ srclib/apr/memory/unix/apr_pools.c 2001/11/22 08:48:27
@@ -1294,12 +1294,10 @@
apr_status_t (*cleanup) (void *),
apr_pool_t *cont)
{
- apr_size_t keylen = strlen(key);
-
if (cont->prog_data == NULL)
cont->prog_data = apr_hash_make(cont);
- apr_hash_set(cont->prog_data, key, keylen, data);
+ apr_hash_set(cont->prog_data, key, APR_HASH_KEY_STRING, data);
if (cleanup) {
apr_pool_cleanup_register(cont, data, cleanup, cleanup);
Re: [PATCH] optimization for apr_pool_userdata_set
Posted by Ian Holsman <ia...@cnet.com>.
On Thu, 2001-11-22 at 01:03, Brian Pane wrote:
> This patch takes advantage of the recent optimizations to
> apr_hash_t's handling of APR_HASH_KEY_STRING to eliminate
> a strlen call within apr_pool_userdata_set.
>
your patch seems to patch apr_pool_userdata_setn not
apr_pool_userdata_set
I've commited the below also applying the same thing to _set
..Ian
> --Brian
>
> Index: srclib/apr/memory/unix/apr_pools.c
> ===================================================================
> RCS file: /home/cvspublic/apr/memory/unix/apr_pools.c,v
> retrieving revision 1.116
> diff -u -r1.116 apr_pools.c
> --- srclib/apr/memory/unix/apr_pools.c 2001/11/21 16:40:54 1.116
> +++ srclib/apr/memory/unix/apr_pools.c 2001/11/22 08:48:27
> @@ -1294,12 +1294,10 @@
> apr_status_t (*cleanup) (void *),
> apr_pool_t *cont)
> {
> - apr_size_t keylen = strlen(key);
> -
> if (cont->prog_data == NULL)
> cont->prog_data = apr_hash_make(cont);
>
> - apr_hash_set(cont->prog_data, key, keylen, data);
> + apr_hash_set(cont->prog_data, key, APR_HASH_KEY_STRING, data);
>
> if (cleanup) {
> apr_pool_cleanup_register(cont, data, cleanup, cleanup);
>
>
--
Ian Holsman IanH@cnet.com
Performance Measurement & Analysis
CNET Networks - (415) 344-2608