monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Call for testing: nvm.experiment.no-split-path


From: Zack Weinberg
Subject: [Monotone-devel] Call for testing: nvm.experiment.no-split-path
Date: Thu, 21 Jun 2007 14:48:46 -0700

I have just completed work on an experimental branch,
net.venge.monotone.experiment.no-split-path, in which I removed all
uses of the "split_path" type.  For the unfamiliar, a split_path is
equivalent to a file_path but has a different representation: it's a
vector of single path components instead of a string.  In the bulk of
the code, we were just passing these things around and then turning
them back into file_paths before doing anything with them.  In the
handful of places that actually needed to work with paths component by
component, mostly what it was doing was walking from a given point
back up to the root of the workspace or roster.  I gave those places
dirname() and basename() methods on file_path, plus a dose of ye olde
recursion tonic, like this:

+static node_t
+get_node_worker(roster_t const & r, file_path const & p)
+{
+  if (p.empty())
+    return r.root();
+
+  node_t parent = get_node_worker(r, p.dirname());
+  if (!parent || !is_dir_t(parent))
+    return node_t();
+
+  dir_t pd = downcast_to_dir_t(parent);
+  dir_map::const_iterator child = pd->children.find(p.basename());
+  if (child == pd->children.end())
+    return node_t();
+
+  return child->second;
+}

In most cases I think this is *easier* to understand than what it
replaced, and *should* be doing strictly less work.  Which is where
you come in.  I'd like to invite folks to try the new branch against
the current mainline on their favorite cases where monotone is too
slow.   I anticipate performance gains - perhaps in the noise - for
anything that beats on csets a lot.  Initial pull might be
interesting.  So should CVS import.  [There is a chance that places
like the above, that call both dirname() and basename() on the same
file_path, might wind up hurting, in which case I have a simple, but
dirty, cure that I would prefer not to implement unless actually
necessary.  So profiles as well as timing differences are
interesting.]

The branch can be found on both 204.152.190.23 and
monotone.mtn-host.prjek.net.  Also, I have a nice beefy amd64 box, so
if you'd rather, you can send me test cases and I'll try them.  Please
to be making said test cases runnable by a trained monkey.  (I am
running errands for the next couple hours but will be back later.)

zw




reply via email to

[Prev in Thread] Current Thread [Next in Thread]