[darcs-devel] Help with alternate current formats: shall we slurp?

Juliusz Chroboczek jch at pps.jussieu.fr
Tue Jan 25 02:13:17 PST 2005


Dear David, dear all,

I need your assistance in making the alternate current formats usable.

As you know, I've been working on making it possible to work without a
pristine tree under _darcs/current.  The basic approach is that every
format for the pristine tree defines a number of methods (in Current)
the most important of which is slurpCurrent, which returns a Maybe Slurpy.

Every use of (slurp "_darcs/current") has been replaced by a call to
surely_Slurp_Current (in Repository) which invokes the corresponding
variant of slurpCurrent and either returns the resulting Slurpy, or
computes a slurpy on the fly by applying all patches since the last
checkpoint.

The net effect is that surely_Slurp_Current always works, but is very
expensive if the format is current.none.

My goal is to make current.none usable for repositories that you don't
work in, such as the repository you publish in your public web space
or the repository you carry on your USB key.  For that, I need get,
send and apply (and hence push and pull) to be reasonably efficient on
current.none repositories.

Now the trouble is that there's a lot of code in Darcs that assumes
that slurping current is cheap.  For example, |darcs get| will slurp
current three times.  |Darcs pull| slurps current no less than five
times.

Fixing the code so that slurping only happens when needed is tedious
but not difficult.  Yesterday evening, I fixed |darcs get| to slurp
only once (the code is too hackish to submit right now); the net
result is that |darcs get| is, as expected, slightly faster over
current.none than over plain current.

The problem is that I don't know whether you're slurping so many times
because it was simpler that way (in which case I'll simply eliminate
all the slurping that's going on), or because you want to discard
touched Slurpies as often as possible in order to free memory.  In
either case I know how to proceed, but the ``slurp if it's cheap''
version will involve going through the Maybe monad quite a lot.

So could you please tell me why you're slurping so often?  For
example, why do you think that slurping again in Get.lhs:139 will save
memory?

Taking Pull.lhs, you slurp current once in slurp_recorded on line 140,
once in slurp_recorded_and_unrecorded at line 154, once in
write_pending at line 194, and once in sync_repo at line 196.  (I'm
missing one, I don't remember where it was.)  Which of these slurps
are necessary, which can safely be removed?

Thanks for your help,

                                        Juliusz




More information about the darcs-devel mailing list