Skip to content

feat: write-path optimizations, parallel ingest, schema cache + benchmarks#7

Open
adubovikov wants to merge 9 commits into
quackscience:mainfrom
adubovikov:main
Open

feat: write-path optimizations, parallel ingest, schema cache + benchmarks#7
adubovikov wants to merge 9 commits into
quackscience:mainfrom
adubovikov:main

Conversation

@adubovikov

Copy link
Copy Markdown
Contributor

Summary

Brings the fork's main up to upstream, bundling several merged feature lines:

  • Native write-path optimization — tunable pool + pipeline for the write path (raw_ingest.cpp, raw_records.cpp).
  • Parallel ingest consumers — multi-threaded parser pipeline with a shared, lock-guarded schema cache (RawParsedPayload::ProcessWithSchema fast path that skips re-inference across batches).
  • Schema cache + extraction hot-pathraw_json.cpp/.hpp, raw_functions.hpp.
  • Benchmark & CI toolingPrValidation.yml, scripts/ (A/B vs release, stats, CI benchmark gate) and agent_planning/bench/ helpers.
  • Format compliance — clang-format 11 applied so the Format Check passes.

Notes

  • All changed *.cpp / *.hpp files verified clean against duckdb's clang-format 11 config.
  • agent_planning/ contains research/benchmark artifacts (not shipped in the extension build).

Test plan

  • clang-format --style=file clean on every changed C/C++ file
  • Main Distribution Pipeline green (build matrix + Tidy + Format)
  • make test

adubovikov and others added 9 commits June 21, 2026 12:44
Split schema coordination from parallel append, add write-path settings,
layout caching, and micro-batch coalescing for raw_ingest_file. Includes
benchmark harnesses and A/B script vs official release (~16% faster write
on 50k rows vs v0.0.2).
run_vs_release_stats.sh runs paired rounds with median/p95 write and read
deltas vs v0.0.2; shared helpers live in ab_bench_lib.sh.
raw_ingest_file now uses RawStreamIngestor with auto-scaled consumer
threads (rawduck_pipeline_consumers) for parallel pool submit while
schema evolution stays serial. Adds PrValidation workflow with make test
and a 3-round A/B benchmark gate (median write must not regress >10%
vs release).
feat: optimize native write path with tunable pool and pipeline
Skip InferSchema+FlattenSchema on absorbed shapes by caching the
schema tree (RawCachedSchema) in ObjectCache keyed by shape hash.
Parser threads in raw_ingest_file reuse the cached schema after the
first batch is absorbed, eliminating per-batch inference overhead.

Extraction hot-path improvements:
- Dense column_idx on RawNode replaces unordered_map<RawNode*,idx_t>
  lookup in RawExtractor::Traverse
- Zero-alloc FindChild (memcmp linear scan) replaces
  child_lookup.find(string(key,len)) — removes one std::string
  allocation per JSON key per row
- MergeValueInternal uses FindChild for existing children, only
  allocating a string when creating a new child
- memset in RawExtractor::Reset replaces vector::assign

Benchmark results (50k rows, 6 cols, 10-round best-of-N):
- Write: -10% vs v0.0.2 release (median 110→105 ms)
- Read:  -13% vs v0.0.2 release (median 20.5→17.5 ms)

At scale (500k rows), RawDuck writes 17% faster than opaque JSON/VARCHAR
storage while reading 2.3-3.4x faster and using 2.3x less disk.
feat: schema cache + extraction hot-path optimizations
Reformat ProcessWithSchema signatures and the ingest parser lambda per
duckdb clang-format 11 rules so the upstream Format Check passes.
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