[darcs-users] benchmarking darcs-1

Eric Kow kowey at darcs.net
Tue Feb 23 21:26:55 UTC 2010


On Tue, Feb 23, 2010 at 16:00:00 -0500, Nathan Gray wrote:
> If you could look over the diff and give some pointers, that
> would be great.  I hope it is close to correct.  I guessed about
> some things though, and my guesses must not have been correct.

> +add_mod :: Int -> BenchmarkCmd ()
> +add_mod n darcs tr = do
> +  cd "repo"
> +  forM [1..n] $ \x -> do
> +    forM files $ \f -> liftIO (appendFile f (show n))
> +    darcs [ "add", show f]
> +    darcs [ "remove", "--all", show f]
> +  return ()
> +    where files = [ "83d4a457-60fb-4a78-9b56-0328a6c6f6f7" ]

It's more or less there.

First, now that we have that we this fancy adaptive framework, there's
no more need to work 1..n times, so you should be able to eliminate that
outer forM.

Second, you have twos minor Haskell syntax issues, (2a) that your
indentation makes the compiler think that the lines
  darcs [ "add", show f]
  darcs [ "remove", "--all", show f]
belong to the outer loop and (2b) that you're missing a "do"

I think Neil Mitchell's 'Explaining IO without Monads' should be
helpful:
  http://neilmitchell.blogspot.com/2010/01/haskell-io-without-monads.html
It's super short and punchy, based on examples of what you want
to do and patterns you can "copy" (while trying to understand why
you want to use them).

The slight twist is that we're not using an IO monad, but a
darcs-benchmark-specific one called 'Command' but I think you
can ignore that detail for now and just pretend we're using IO

I hope that helps!  Sorry for the minimal help; I'm obsessively working
on making those cumulative results tables I've been wanting!

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.osuosl.org/pipermail/darcs-users/attachments/20100223/41243804/attachment.pgp>


More information about the darcs-users mailing list