tvl-depot/third_party/lisp
sterni 3d2e55ad53 refactor(mime4cl): replace *-input-adapter-stream with flexi-streams
The input adapter streams were input streams yielding either binary or
character data that could be constructed from a variable data source.
The stream would take care not to destroy the underlying data
source (i.e. not close it if it was a stream), so similar to with
FILE-PORTIONs, but simpler.

Unfortunately, the implementation was quite inefficient: They are
ultimately defined in terms of a function that retrieves the next
character in the source. This only allows for an implementation of
READ-CHAR (and READ-BYTE). Thanks to cl/8559, READ-SEQUENCE can be used
on e.g. FILE-PORTION, but this was still negated by a input adapter
based on one—then, READ-SEQUENCE would need to fall back on READ-CHAR or
READ-BYTE again.

Luckily, we can replace BINARY-INPUT-ADAPTER-STREAM and
CHARACTER-INPUT-ADAPTER-STREAM with a much simpler abstraction: Instead
of extra stream classes, we have a function, MAKE-INPUT-ADAPTER, which
returns an appropriate instance of FLEXI-STREAM based on a given source.
This way, the need for a distinction between binary and character input
adapter is eliminated, since FLEXI-STREAMS supports both binary and
character reads (external format is not yet handled, though).
Consequently, the :binary keyword argument to MIME-BODY-STREAM can be
dropped.

flexi-streams provides stream classes for everything except a stream
that doesn't close the underlying one. Since we have already implemented
this in POSITIONED-FLEXI-INPUT-STREAM, we can split this functionality
into a new superclass ADAPTER-FLEXI-INPUT-STREAM.

This change also allows addressing the performance regression
encountered in cl/8559: It seems that flexi-streams performs worse when
we are reading byte by byte or char by char. (After this change mblog is
still two times slower than on r/6150.) By eliminating the adapter
streams, we can start utilizing READ-SEQUENCE via decoding code that
supports it (i.e. qbase64) and bring performance on par with r/6150
again. Surely there are also ways to gain back even more performance
which has to be determined using profiling. Buffering more aggressively
seems like a sure bet, though.

Switching to flexi-streams still seems like a no-brainer, as it allows
us to drop a lot of code that was quite hacky (e.g. DELIMITED-INPUT-
STREAM) and implements en/decoding handling we did not support before,
but would need for improved correctness.

Change-Id: Ie2d1f4e42b47512a5660a1ccc0deeec2bff9788d
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8581
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
2023-05-18 16:14:38 +00:00
..
asdf-flv chore: Rename pkgs->depot in all Nix file headers 2020-02-21 13:54:53 +00:00
closure-html chore(3p/lisp): use nixpkgs sources for closure-html 2021-12-15 21:02:10 +00:00
mime4cl refactor(mime4cl): replace *-input-adapter-stream with flexi-streams 2023-05-18 16:14:38 +00:00
npg chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00
qbase64 feat(3p/lisp): add qbase64 2023-05-14 14:42:43 +00:00
quasiquote_2 chore: Rename pkgs->depot in all Nix file headers 2020-02-21 13:54:53 +00:00
s-xml style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
alexandria.nix chore(3p/lisp): Unvendor alexandria and use nixpkgs sources 2021-12-15 21:02:10 +00:00
anaphora.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
babel.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
bordeaux-threads.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
cffi.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
chipz.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
chunga.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-ansi-text.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-base64.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-colors.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-colors2.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-date-time-parser.nix feat(3p/lisp/cl-date-time-parser): init at 00d6fc7 2022-01-26 17:43:54 +00:00
cl-fad.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
cl-json.nix feat(nix/buildLisp): re-enable CCL 2022-08-30 17:51:35 +00:00
cl-plus-ssl.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
cl-ppcre.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-prevalence.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-smtp.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-unicode.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
cl-who.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
cl-yacc.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
closer-mop.nix feat(3p/overlays/ecl-static): 21.2.1 -> 1c98924 2022-01-28 10:43:01 +00:00
closure-common.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
defclass-std.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
drakma.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
easy-routes.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
fiveam.nix chore(3p/lisp): use nixpkgs sources for fiveam 2021-12-15 21:02:11 +00:00
flexi-streams.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
global-vars.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
hunchentoot.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
ironclad.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
iterate.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
lass.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
let-plus.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
lisp-binary.nix feat(3p/lisp/lisp-binary): 2022-04-10 -> 2022-09-19 2022-12-19 13:13:00 +00:00
local-time.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
marshal.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
md5.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
metabang-bind.nix feat(3p/lisp): add metabang-bind 2022-01-19 13:13:09 +00:00
moptilities.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
nibbles.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
OWNERS chore(gerrit): migrate OWNERS files to code-owners style 2022-09-19 11:13:28 +00:00
parse-float.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
parse-number.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
parseq.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
physical-quantities.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
postmodern.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
prove.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
puri.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
rfc2388.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
routes.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
s-sysdeps.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
split-sequence.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
trivial-backtrace.nix chore(3p/lisp): use nixpkgs sources for trivial-backtrace 2021-12-15 21:14:12 +00:00
trivial-features.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
trivial-garbage.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
trivial-gray-streams.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
trivial-indent.nix refactor(3p/lisp): Use sources from nixpkgs where possible 2021-12-15 10:34:02 +00:00
trivial-ldap.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
trivial-mimes.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
uax-15.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
unix-opts.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
usocket-server.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00
usocket.nix style: format entire depot with nixpkgs-fmt 2022-01-31 16:11:53 +00:00