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

Re: svn commit: r33021 - branches/explore-wc/subversion/libsvn_wc

From: Erik Huelsmann <ehuels_at_gmail.com>
Date: Thu, 11 Sep 2008 16:26:58 +0200

Hi Greg,

> +svn_error_t *
> +generic_walker(svn_wc__db_t *db,
> + const char *path,
> + walker_func_t walk_func,
> + void *walk_baton,
> + apr_pool_t *scratch_pool)
> +{
> + apr_array_header_t *queue = apr_array_make(scratch_pool, 0, 10);
> + apr_pool_t *iterpool = svn_pool_create(scratch_pool);
> + struct walker_entry *entry = apr_palloc(scratch_pool, sizeof(*entry));
> +
> + entry->dirpath = path;
> + entry->name = "";
> + APR_ARRAY_PUSH(queue, struct walker_entry *) = entry;
> +
> + while (queue->nelts > 0)
> + {
> + const char *nodepath;
> + svn_wc__db_kind_t kind;
> +
> + svn_pool_clear(iterpool);
> +
> + /* pull entries off the end of the queue */
> + entry = APR_ARRAY_IDX(queue, queue->nelts - 1, struct walker_entry *);
> +
> + nodepath = svn_path_join(entry->dirpath, entry->name, iterpool);
> + SVN_ERR(svn_wc__db_read_info(&kind, NULL, NULL, NULL, NULL, NULL,
> + NULL, NULL, NULL, NULL, NULL, NULL,
> + db, nodepath, iterpool, iterpool));
> + if (kind == svn_wc__db_kind_dir)
> + {
> + const apr_array_header_t *children;
> +
> + /* copy the path into a long-lived pool */
> + const char *dirpath = apr_pstrdup(scratch_pool, nodepath);
> +
> + SVN_ERR(svn_wc__db_read_children(&children, db, nodepath,
> + scratch_pool, iterpool));
> +
> + append_entries(queue, dirpath, children, scratch_pool);
> + }
> +
> + (*walk_func)(nodepath, walk_baton, iterpool);
> + }
> +
> + svn_pool_destroy(iterpool);
> + return NULL;
> +}

When I look at one of the current problems in the WC is that we use a
database to determine what *should* be there, then using stat() to
find out if it's actually there. This is one of our biggest
performance problems.

I have been thinking that we could try to shift that around: using
readdir() to determine what's there and then using the database to
find out if our administration agrees. This way, stat()s could be
concentrated, probably even optimized by the OS, instead of requiring
single stat() calls for everything we want to know.

Not that there's anything wrong with the design above, even with what
I describe there may still be use-cases for this API, I just wanted to
point out that using a BASE or WORKING tree as the basis to operate
from (instead of the ACTUAL tree) may perpetuate existing problems.

It's just one of those mind-dumps. Sorry if this is completely out of
context. :-)

Bye,

Erik.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-09-11 16:27:31 CEST

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