[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: r1414123 - optimize iprops retrieval in libsvn_wc

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Wed, 28 Nov 2012 19:25:50 +0000 (GMT)

> URL: http://svn.apache.org/viewvc?rev=1414123&view=rev

> Log:
> In preparation for further performance improvements, make the
> retrieval of inherited properties use a constant number of db
> operations.

My comments are about the existing code, not specifically about this revision.

> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> ==============================================================================

> +/* Remove all prop name value pairs from PROP_HASH where the property
> +  name is not PROPNAME. */
> +static void
> +filter_unwanted_props(apr_hash_t *prop_hash,
> +                      const char * propname,
> +                      apr_pool_t *scratch_pool)
> +{
> +  apr_hash_index_t *hi;
> +
> +  for (hi = apr_hash_first(scratch_pool, prop_hash);
> +      hi;
> +      hi = apr_hash_next(hi))
> +    {
> +      const char *ipropname = svn__apr_hash_index_key(hi);
> +
> +      if (strcmp(ipropname, propname) != 0)
> +        apr_hash_set(prop_hash, ipropname, APR_HASH_KEY_STRING, NULL);
> +    }

I suppose a much quicker way to select just the wanted key-value pair from the hash is:

  propval = hash_get(propname)
  hash_clear()
  if propval:
    hash_set(propname, propval)

> +  return;
> +}
[...]

> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
> ==============================================================================

> +/**
> + * Set @a *inherited_props to a depth-first ordered array of

"depth-ordered", not depth-first.

> + * #svn_prop_inherited_item_t * structures representing the properties
> + * inherited by @a local_abspath from the ACTUAL tree above
> + * @a local_abspath (looking through to the WORKING or BASE tree as
> + * required), up to and including the root of the working copy and
> + * any cached inherited properties inherited by the root.
> + *
> + * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool
> + * for temporary allocations.
> + */
> +svn_error_t *
> +svn_wc__db_read_inherited_props(apr_array_header_t **iprops,
> +                                svn_wc__db_t *db,
> +                                const char *local_abspath,
> +                                const char *propname,
> +                                apr_pool_t *result_pool,
> +                                apr_pool_t *scratch_pool);

- Julian
Received on 2012-11-28 20:26:39 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.