On Thu, Sep 24, 2009 at 3:40 PM, Taylor R Campbell <campb...@mumble.net> wrote: > Date: Thu, 24 Sep 2009 13:48:34 -0700 > From: Joe Marshall <jmarsh...@alum.mit.edu> > > Has anyone measured the performance difference between smashing > the string head and just taking a substring? I'd bet it's a pretty minimal > improvement against the background of the other things that happen during > I/O. > > I conducted a thoroughly unscientific comparison whose source code is > attached: making a string of length 2^(i + 1), taking a prefix of > length 2^i, and then discarding it, repeating the process ten thousand > times.
I haven't seen much production code that uses it in this way. I don't doubt that it is quicker to truncate the string than to copy it. I was wondering if it took up a significant amount of time when calling WITH-OUTPUT-TO-STRING or INPUT-PORT/READ-STRING -- ~jrm _______________________________________________ MIT-Scheme-devel mailing list MIT-Scheme-devel@gnu.org http://lists.gnu.org/mailman/listinfo/mit-scheme-devel