Skip to content

Deduplicate dictionary section thread spawning in nt.rs - #145

Merged
KonradHoeffner merged 1 commit into
mainfrom
nt-spawn-dedup
Nov 11, 2026
Merged

KonradHoeffner merged 1 commit into
mainfrom
nt-spawn-dedup

Conversation

@KonradHoeffner

@KonradHoeffner KonradHoeffner commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Generated by OpenCode.

Summary

build_dict_and_id_maps in src/nt.rs contained four nearly identical thread::Builder::new().name(...).spawn_scoped(...) blocks — one per dictionary section (shared, unique subjects, predicates, unique objects) — plus four *_ref borrow aliases, ~40 lines of copy-paste.

This replaces them with one [(name, keys); 4] array and a single sections.map(...) call inside the thread::scope closure, destructured into the four join handles.

Net: −22 lines (14 insertions, 36 deletions).

Behavior is unchanged:

  • same four scoped threads with the same names (shared, unique subjects, predicates, unique objects)
  • same DictSectPFC::compress_iter(keys.iter().map(|&k| terms.get(k)), keys.len(), block_size) calls
  • same spawn and join order

Verification

  • cargo fmt --check clean
  • all CI feature combos pass (--all-targets --features cache, --no-default-features, --features sophia, --features "cache sophia", plus --features nt)
  • cargo clippy --all-features --all-targets: only the 3 pre-existing warnings in other files (hdt.rs CRC placement, sparql.rs w3c_tests length, criterion.rs redundant closure)
  • cargo test --all-features: 27 unit + 18 doc tests pass, including the nt:: tests (read_nt, from_triples, read_nt_escapes) that exercise this code path end-to-end

@github-actions

Copy link
Copy Markdown

📊 Code Metrics (Rust)

State Files Blank Comment Code
Before 29 537 1002 4290
After 29 537 1002 4268
Diff 0 0 0 -22
% Diff 0.0% 0.0% 0.0% -0.5%

@KonradHoeffner
KonradHoeffner merged commit 0138f18 into main Nov 11, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant