feat: parallelize sixel and kitty image encoding with cl-concurrent-kit - #14
Merged
Merged
Conversation
Both FORMAT-SIXEL and ANSI-KITTY-IMAGE now accept an optional :EXECUTOR (a caller-owned CL-CONCURRENT-KIT:EXECUTOR) and :CHUNK-COUNT. When supplied and WIDTH*HEIGHT clears +SIXEL-PARALLEL-PIXEL-THRESHOLD+ (64x64), color quantization and the per-band/per-APC-chunk encoding pass run across the executor's workers instead of the calling thread; otherwise both stay fully serial, unchanged from before. Output is byte-identical in either mode, verified against tens of chunk-count/size combinations including non-power-of-two counts that would surface an uneven-partition bug. Measured on this host: format-sixel 6.7-6.9x at 256x256/512x512 (both the color-quantization and band-encoding phases parallelized -- band-only gave just 1.5-1.7x, since quantization was 43-55% of total runtime and capped the Amdahl ceiling); ansi-kitty-image 3.7-4.3x at 256x256 up to 2048x2048, where serial cost reaches 76ms and is worth parallelizing for the first time. Also fixes scripts/benchmark-hotpaths.lisp, which aborted on its first case under a stale keyword-argument MAKE-STYLE call, and then (once fixed) on comparing PLAN-DIFF-LENGTH's ungrouped upper-bound estimate against the grouped length %WRITE-PREFERRED-DIFF actually renders -- the renderer's strategy choice was already correct; only the benchmark's own gate compared the wrong number. The script now runs every case end to end.
takeokunn
force-pushed
the
feat/concurrent-kit-image-parallelism
branch
from
August 5, 2026 16:36
1344479 to
e23a048
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
format-sixelandansi-kitty-imageaccept an optional:executor/:chunk-count, parallelizing color quantization and band/APC-chunk encoding across a caller-ownedcl-concurrent-kit:executorwhen the image is at least 64x64.:executor) behavior is fully serial and unchanged; output is byte-identical either way, verified across dozens of chunk-count/size combinations including odd, non-power-of-two counts.scripts/benchmark-hotpaths.lisp, which previously aborted before running any case.Measured
format-sixel: 6.7-6.9x at 256x256/512x512 (both phases parallel; band-only alone only reached 1.5-1.7x due to Amdahl's law on the quantization phase)ansi-kitty-image: 3.7-4.3x at 256x256 up to 2048x2048Test plan
run-tests.lispsuite passing, including new byte-identical serial-vs-parallel testsnix flake check: exit 0scripts/benchmark-hotpaths.lispnow runs to completion