tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Postgres: decode messages in place; accumulate socket reads in a builder

protocol.next(buffer, at) parses a frame at an offset and answers the
offset past it, instead of slicing payload and rest out of the buffer
(two copies per message). The payload cursor reads scalars in place —
read_be32 was a 4-byte slice plus a 4-cell List<Int> per field — and
strings decode straight from the buffer (to_string_range, one copy). A
DataRow field's length and value read fuse into one step.

client.read_message threads (buffer, offset): a message already whole in
the buffer parses with no copy at all; one straddling reads moves its
tail into a bytes.Builder once and appends each chunk in place, instead
of re-concatenating the whole remainder per socket read. The package's
public API (lib.lse, Socket) is unchanged.

A synthesized 1000-row, 10-column DataRow stream decoded 300 times:
91.2G -> 30.9G instructions (-66%), 136 -> 36 heap blocks per row
(tl_alloc counted under gdb), wall 22.7s -> 6.6s best-of-5.

olivier · il y a 1 mois · 4f0e39985e8e17a675121c87f39b8edd231d2b5f

Parents 0208dd8

4 fichiers modifiés, 259 ajouts, 181 suppressions