[darcs-users] optimization in HEAD: darcs diff

Guillaume Hoffmann guillaumh at gmail.com
Mon May 21 19:59:56 UTC 2012


I'd like to share to the darcs-users list another significant change
in HEAD that happened after the release of Darcs 2.8, this time an
optimization.

In 2010 Petr Rockai optimized the "darcs diff" command, but a few
things blocked the inclusion of this piece of code into darcs.
Notably, the optimization did not support old-fashioned repositories.
However, since version 2.8 Darcs no longer fully support these
repositories, so the new implementation of "diff" has been ported to
HEAD.

As in Petr's words (http://bugs.darcs.net/patch351):

----8<----
I have changed the diff code to only write those files that actually changed in
the temporary locations. On my other project (less than 1000 working copy
files):

(with cold cache)
head: darcs diff  1,09s user 0,58s system 9% cpu 16,752 total
now:  darcs diff  0,14s user 0,04s system 6% cpu 2,978 total

(with hot cache)
head: darcs diff  0,36s user 0,18s system 98% cpu 0,548 total
now:  darcs diff  0,06s user 0,01s system 86% cpu 0,078 total
---->8----

I've added more informal benchmarks at the end of this mail.

So, if you want to build a darcs from HEAD and discover again "darcs
diff", have a go at it and see how fast it has become!
If you are using an external diffing tool, you can use the new flag
--no-pause-for-gui (http://bugs.darcs.net/patch748) implemented by
Michael Hendricks.

Following the switch to this new implementation, Owen Stephens noticed
that diffing directories no longer worked
(http://bugs.darcs.net/issue2179) but Yuriy Vostrikov soon sent a
patch fixing this issue (http://bugs.darcs.net/patch818).

If you find more bugs, please let us know!

Guillaume

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

Informal benchmarks on http://darcs.net/ between darcs 2.8 and current HEAD.
("time darcs diff" is run until the time ouput becomes consistent, ie,
benchmarks are done on hot disk cache).

Last patch in HEAD ("kill footnotes"):

2.8
real    0m0.598s
user    0m0.380s
sys     0m0.190s

HEAD
real    0m0.194s
user    0m0.180s
sys     0m0.010s

With a patch deeper in the history ("update NEWS log with 2.5.1")

2.8
real    0m4.424s
user    0m1.550s
sys     0m1.300s

HEAD
real    0m1.342s
user    0m1.250s
sys     0m0.090s

Even older (patch "Import bracketOnError from Workaound" from 2006):

2.8
real    1m17.442s
user    0m17.650s
sys     0m16.960s

HEAD
real    0m18.054s
user    0m17.670s
sys     0m0.370s


More information about the darcs-users mailing list