[darcs-users] darcs patch: Remove premature optimization.

Ganesh Sittampalam ganesh at earth.li
Sat May 23 16:59:29 UTC 2009


On Sat, 23 May 2009, Trent W.Buck wrote:

> Out of interest, I replaced the horribly confusing code with an
> obviously inefficient -- but readable -- version, and timed
> difference.  The sum of three runs of "darcs show authors" on the
> Darcs repo and the darcs-wiki repo, on a fast system, is:
>
>  real   user   sys
>  1.090s 0.670s 0.140s          -- without this patch
>  3.394s 3.080s 0.160s          -- with this patch
>
> So readability will quintuple the CPU time, though the operation's
> total time is negligible.  Is it worth applying this patch?

I think if the slow code takes 0.5s (3s/6) on a medium sized repo then we 
can't consider the total time negligible and should keep the fast code.

Cheers,

Ganesh


More information about the darcs-users mailing list