Hi, Kevin Ryde <[EMAIL PROTECTED]> 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.) When modifying `iprin1 ()', I considered traversing the string to see if it contained non-printable characters, and then deciding whether to write it with a single `scm_lfwrite ()' call (if it did not contain non-printable char) or not. I preferred my "traverse-and-rewrite" approach (again, this really isn't buffering) as it sounded less complex and probably more optimal in the presence of non-printable characters. But you're welcome to prove me wrong. ;-) As for `display' (which Paul pointed out), it turns out that it is already special-cased in `iprin1 ()' for strings (see `if SCM_WRITINGP (pstate) ... else scm_lfwrite (...)'), meaning that _displaying_ a string always leads to a single `scm_lfwrite ()' call. IOW, even if the output port is unbuffered, displaying a string currently leads to a single `write' syscall. To summarize: the problem I was trying to address is only relevant to `write' for strings. It is a significant optimization in the case of an unbuffered output port which is the default. It's a less important optimization if the output port is buffered. Thanks, Ludovic. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user