Summary

port decoding is inefficient

Metadata

Description

Currently the port decoding is done by converting to UTF-8 then decoding that. But for binary and latin1 encoded data it would be much more efficient to use thebyte values directly. The reason for this is that the decoding for UTF-8 was implemented first, then arbitrary port-encodings were implemented on top of that. The relevant internal machinery (##sys#read-char/encoding, ##sys#decode-char, ##sys#decode-buffer) should be rewritten to create characters immediately from the port data.

Alternatively, we should add at least fast paths to decode single chars from binary/latin1 ports.