[plt-scheme] scribblings on PLT Scheme 4.0
On Mon, 2007-05-28 at 09:49 +0800, Matthew Flatt wrote:
> At Mon, 28 May 2007 09:44:38 +1000, Andrew Reilly wrote:
> > I'm new to scheme myself, so I probably sholdn't have been
> > making such liberal use of append! in my own code. I will
> > repent...
>
> Do you used them for performance reasons?
>
> I used `append!' and `reverse!' a lot in my early Scheming, too,
> because they were faster. It bit me often enough (no surprise) that I
> decided to stay away, though there are certainly cases where mutating
> versions work fine.
>
> These days, it helps that we have a reasonable memory manager. While
> `append!' and `reverse!' are still faster in 3m than `append' and
> `reverse', allocation and GC are so much faster that I don't worry as
> much about the extra pairs (which is as it should be). In the
> microbenchmark below, the `append!' variants run almost 2x as fast in
> both 3m and CGC, but 3m is about 4x as fast as CGC.
But there's space efficiency to be considered as well as time, isn't
there? There's a lot of consing going on with the pure variants.
-- Bill Wood