Skip to content

Profile with hotpath and speed up result encoding - #14

Merged
JetSquirrel merged 1 commit into
mainfrom
perf/hotpath-cli-encoding
Oct 4, 2026
Merged

JetSquirrel merged 1 commit into
mainfrom
perf/hotpath-cli-encoding

Conversation

@JetSquirrel

Copy link
Copy Markdown
Owner

Add hotpath behind hotpath/hotpath-alloc/hotpath-cpu features (no-op otherwise) and instrument the headless query, schema and profile paths.

What the profile showed, and the fixes:

  • Tagged cells (DECIMAL, DATE, TIMESTAMP, TIME, BLOB) cost ~5x a plain one: build the map at its final size and use static unit names instead of json! and a Debug render.
  • ducklocal query spent ~40% of its time freeing the result just before exiting; forget it after printing. End to end 20-26% faster at 2M cells.
  • An analysis app's query() deep-copied the result twice: in capture::query even when nothing was recording, and per cell in query_value. Skip the first, move cells in the second.
  • Grid dates and timestamps were formatted through chrono's strftime path; write the fields directly (117 -> 94 ms, 3.7M -> 2.5M allocations for 1.2M cells, new probe A4).

Add hotpath behind `hotpath`/`hotpath-alloc`/`hotpath-cpu` features (no-op
otherwise) and instrument the headless query, schema and profile paths.

What the profile showed, and the fixes:
- Tagged cells (DECIMAL, DATE, TIMESTAMP, TIME, BLOB) cost ~5x a plain one:
  build the map at its final size and use static unit names instead of
  `json!` and a `Debug` render.
- `ducklocal query` spent ~40% of its time freeing the result just before
  exiting; forget it after printing. End to end 20-26% faster at 2M cells.
- An analysis app's `query()` deep-copied the result twice: in
  `capture::query` even when nothing was recording, and per cell in
  `query_value`. Skip the first, move cells in the second.
- Grid dates and timestamps were formatted through chrono's strftime path;
  write the fields directly (117 -> 94 ms, 3.7M -> 2.5M allocations for
  1.2M cells, new probe A4).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@JetSquirrel
JetSquirrel merged commit 99ad8d6 into main Oct 4, 2026
2 of 3 checks passed
@JetSquirrel
JetSquirrel deleted the perf/hotpath-cli-encoding branch October 6, 2026 18:05
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