From 17c517fd02ff4419a1bd615e0df571fced2c24bf Mon Sep 17 00:00:00 2001
From: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
Date: Sat, 5 Sep 2026 20:35:27 +0200
Subject: [PATCH] chore: nitpicks after multithreading review (#1172)
* chore: nitpicks after multithreading review
* chore: remove call sites from ARCHITECTURE.md
* chore: minor reliability corrections
---
AGENTS.md | 1 -
ARCHITECTURE.md | 111 +++++---------------
Cargo.toml | 2 +-
src/helper/item_reader.rs | 28 +++--
src/matcher.rs | 169 ++++++++++++++++++++++++++----
src/reader.rs | 42 +++++---
src/skim.rs | 10 +-
src/spinlock.rs | 6 +-
src/tui/app.rs | 18 +++-
src/tui/item_list.rs | 21 +++-
src/tui/item_list_tests.rs | 21 +++-
src/tui/preview.rs | 209 +++++++++++++++++++++++++++----------
src/tui/preview_tests.rs | 47 ++++++++-
13 files changed, 480 insertions(+), 205 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
index e74766ce..f3aaa852 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -34,7 +34,6 @@
- Changing the threading model or synchronization primitives
- Adding or removing public API surface (`SkimItem`, `SkimOptions`, `SkimOutput`, etc.)
- Changing the event/action system or key binding infrastructure
-- Keep call-site line numbers in the cross-reference table up to date when the referenced functions move.
## Testing
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 57de0c1f..de6169f0 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -428,7 +428,8 @@ Source (stdin bytes or child process stdout)
└── parallel_bufread() (all inputs)
├─ Thread 1: I/O reader — reads 256 KB chunks, splits at line boundaries,
│ assigns monotonic sequence numbers, sends to MPMC channel
- ├─ Thread N: workers — receive chunks, validate UTF-8,
+ ├─ Thread 1: bounded dispatcher — uses in-flight tokens to limit queued/running jobs
+ ├─ Pool workers: receive chunk jobs, validate UTF-8,
│ create DefaultSkimItem::new(line, ansi, trans_fields, matching_fields, delimiter)
│ .hidden_fields(hidden_fields, delimiter)
│ (handles ANSI stripping, --nth / --with-nth / --hide-nth inline),
@@ -491,7 +492,7 @@ Engines are composable through the factory pattern. Starting from `Matcher::crea
options
│
├── if regex mode:
- │ RegexEngineFactory
+ │ RegexEngineFactory (configured with the same RankBuilder / --tiebreak criteria)
│ └─ if normalize: NormalizedEngineFactory(RegexEngineFactory)
│
└── else (fuzzy/exact mode):
@@ -581,12 +582,12 @@ Matcher::run(query, item_pool, thread_pool, …)
│ └─ merge_worker_results(worker_results, no_sort, …)
│ ├─ concatenate k sorted runs
│ ├─ sort() (stable; driftsort detects k runs → O(n log k))
- │ └─ write into SpinLock