; Acknowledge reception
(and (display "OK\n" port) (force-output port)))))))
The benefit here is the saving of a with-exception-catcher calls for each read-u8 call, and depending on how you'd do it otherwise, the saving of one or two with-exception-catcher calls for the display and force-output calls and saving of the possibility of doing force-output on port when display already reported it as closed.
Concluding notes re implementing this
I may very well get into implementing a Gambit commit for providing this functionality.
On my end, it will make ground for doing well-deserved cleanup to Sack and the to-be-released OpenSSL SSL channels module, both IO-intensive modules for production use, that currently use version-unsafe hacks to simulate the functionality proposed above.
I do not claim any copyright on suggestions or commits I send to Gambit but leave them in public domain.
Bigger picture, for reference
What motivated me to propose this as well as recently proposing
is that I've gotten to the conclusion that Gambit's builtin IO system is strikingly good as it is and has the potential to scale for any practical usecase I can imagine with only minor-ish tweaks.
The usecases to tweak for that I see relevant are
a) Realworld IO-intense use (which the proposal in this email seeks to improve in a quite fundamental way through a quite trivial tweak),
b) Deep C integration out of the box (which 1 and 2 above regard, really trivial tweaks those two too), and
c) Delivering low-level application-level ports e.g. SSL and GZip (3 above regard this, I didn't get to any specific proposal for this til now but from reviewing _io.scm it cannot be a very big deal to do)
d) Later I'd guess: Hybrid character and byte access of ports (for ISO-8859-1 encoding, I believe it's already in the box, maybe some clarification needed and possibility for support for more encodings could be looked into)
And last
e) Making the IO system's UTF-8 coder suitable for any use at all, because it's not due to a freeze-crash bug!!
f) Perhaps later: Higher IO procedure call performance through lower overhead on primarily the per-byte/character calls i.e. read-byte read-char, perhaps by making them automatically inlined and/or by making their mutex use configurable.
read-u8 currently delivers ~350KB/sec and an increase to 25MB/sec should be realistic.
For now though this can easily be worked around by application-level buffers and use of read/write-subu8vector, though that does come with drawbacks i.e. doesn't integrate well with hybrid byte-character use etc.
These are the only practical improvements that have come to my mind in total from several years of intense use of this functionality. Zooming out a bit, this is impressively little really.
I would kindly ask you for your feedback on the suggestion regarded by this email. :)
Best regards,
Mikael