[darcs-devel] What happened to Printer.lhs?

Ian Lynagh igloo at earth.li
Thu Feb 10 08:36:06 PST 2005


On Wed, Feb 09, 2005 at 09:33:38PM +0100, Juliusz Chroboczek wrote:
> 
> I recently happened to look at Printer again, and it turns out that
> all of that work was replaced by some strange scheme based on ``Both''
> strings and PackedStrings.

The datatype

    data Printable = S !String
                   | PS !PackedString
                   | Both !String !PackedString

is essentially the same as the

    data PChar = C !Char | PS !PackedString

you introduced only it allow us to have both answers available if they
are equally easy for us. I suspect removing the Both constructor would
make very little difference, but I haven't tested that.

> The change was apparently done by Ian
> Lynagh (the original author of the Printer) on November 30.
> 
> Ian, have you done any profiling when you committed your change?

Yes, and I got an improvement in the cases I tested.
[ insert plea for timesuite and memorysuite here  :-) ]

By using hPutDoc and friends (I think I made some other changes around
the same time to increase the number of places we do so) where possible
we avoid doing as much conversion, either PS -> String or String -> PS,
as possible, and maximise the sharing that can happen.

If you find cases where profiling shows, taking into account memory and
time, a significant drop in performance over the old stuff then we can
look at them and, if necessary, reinstate the extra complexity.

> I understand that you may feel that my version was too complex for you
> to maintain;

It's not an issue of "too complex" but of "needlessly complex".
I believe the new way ought to be at least as efficient.

> Additionally, I would have appreciated it if you could have sent me an
> e-mail telling me why you undid my changes.

I didn't undo your changes - as you noted, it didn't end up as it was
before you started. I merely improved and simplified what was there.

Going through the darcs history each time I make a change (or even just
each time I make a simplification) to see if my change could be
considered a reversion, and finding and e-mailing the author of the code
if so, is unreasonable IMO.

If you want to keep an eye on what's happening then (with the exception
of David's) the patches are sent to the devel list, or you can view
patches you are interested in as you pull them.


Thanks
Ian





More information about the darcs-devel mailing list