Optimization: (FORMAT STREAM ...) should do a single write(2)
Looking at strace of an ECL program is embarrassing when (FORMAT STREAM ...)
is run.
For example:
(format t "foo~%")
Will show this kind of output:
write(1, "f") = 1
write(1, "o") = 1
write(1, "o") = 1
write(1, "\n") = 1
In practice, anything using ecl_write_string
ends up with this kind of behavior, given that ecl_write_string
does something akin to (loop for char across string do (write-char char))
.
I'm sure this is an optimization that can be done by e.g. converting the string to a byte vector and write it at once? I'm not sure how e.g. interpolation is supposed to play with that, however.
Generally speaking, doing an in-memory transformation of the string before sending over to the kernel sounds like a good idea.
I could try out a patch for this, if you're interested in it.