guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Improved string writing


From: Ludovic Courtès
Subject: Re: [PATCH] Improved string writing
Date: Thu, 26 May 2005 17:38:10 +0200
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Hi,

Marius Vollmer <address@hidden> writes:

> Kevin Ryde <address@hidden> writes:
>
>> (I notice "write" style string output in iprin1() always goes
>> char-by-char, it'd be nice if it scanned ahead for a char needing an
>> escape, to send the non-escape block as a single lfwrite.  Decent size
>> runs of plain chars are probably quite likely.)
>
> I like this variant best.  I don't think that writing strings with
> lots of escape sequences to an unbuffered port happens often enough to
> justify implementing a second buffering mechanism.
>
> When outputting an escaped char, we can additionally assemble the
> escape sequence in a fixed size buffer and then output that in one go.

I think you overlooked my patch.  :-)

It also assumes that outputting escaped characters is pretty rare.
Therefore, it only relies on a fixed-size buffer (whose size is that of
the string plus a few bytes).  This buffer gets filled in in _one_
string traversal if there are no (or not a lot of) escaped characters.

So the string doesn't need to be traversed earlier, and escaped chars
need not be sent alone to `scm_lfwrite ()'.

Well, anyway, that's not such a big deal.  ;-)

Thanks,
Ludovic.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]