SPB Git

spb/metrika Public

Stata-class statistics, GPU-accelerated by Apple Silicon. Native Swift — no Electron, no Python runtime, no compromises.

Swift 92.4% HTML 3.3% R 3% Shell 1.3%

History of MetrikaKit/Sources/ZQData/DuckDBStore.swift · clear filter

  1. perf(data): 880x faster loads via DuckDB C-API bulk extraction
    - root cause: duckdb-swift's element(forColumn:at:) linearly rescans
      every chunk on every element access — O(rows x chunks); a 10M-row CSV
      load took 276 s
    - DuckDBFastReader: pointer-based duckdb C calls via @_silgen_name (the
      C library is statically linked; only pointer-argument functions are
      declared, so no struct-ABI exposure), private in-memory instance,
      contiguous column_data/nullmask_data extraction
    - ZQDataStore.dataFrame(fromQuery:): LIMIT-0 schema probe through the
      supported API, SQL-side casts to DOUBLE/VARCHAR, memcpy per numeric
      column; dead per-element materializer removed
    - measured (M4-class): 10M-row parquet 0.20 s, csv 0.31 s, summarize
      ~0.27 s, robust reg ~0.24 s — CLAUDE.md §8 budgets met; table updated
      with measured numbers
    - 116 tests green (identical numerics through the new path)
    - version 1.0.1
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    simon-pierre boucher committed 6 days ago (Aug 5, 2026) · 1 file changed +32 −41
  2. feat(data): native Stata .dta reader (117-119) and writer (118)
    - DTAReader: formats 117/118/119, both byte orders, all numeric storage
      types widened to Float64 with Stata missing codes (., .a-.z) mapped to
      the validity mask; str# and strL (GSO) load as strings; value labels
      read past but not yet applied; pre-117 files rejected with a clear
      message
    - DTAWriter: format 118 (UTF-8, LSF), doubles + str# up to 2045 bytes,
      real map offsets so Stata/haven/pandas can seek
    - ZQDataStore routes .dta through the native path for use and save
    - ZQColumnData equality now ignores value slots at missing positions
      (undefined by contract, often NaN — synthesized == failed on NaN != NaN)
    - Fixtures: haven-written 117 + 118 files; tests assert bit-identical
      numeric loads vs the CSV, lossless write/read roundtrip; haven
      cross-reads Metrika-written files (verified)
    - 61 tests green
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    simon-pierre boucher committed 6 days ago (Aug 5, 2026) · 1 file changed +10
  3. feat: bootstrap Metrika v0.1 skeleton with working ZQL vertical slice
    - MetrikaKit SPM package: ZQParser, ZQPlanner, ZQEngine, ZQData, ZQStats,
      ZQGPU, ZQGraphics, ZQPlugins (Swift 6, strict concurrency)
    - ZQL parser: lexer, Pratt expressions, factor variables, prefix commands,
      column-cited errors with Levenshtein verb suggestions
    - ZQData: DuckDB-backed load/save (parquet, csv, json, arrow)
    - ZQStats: OLS via LAPACK QR, HC0-HC3 and cluster-robust SE, summarize,
      t/F distributions accurate in the far tails
    - ZQGPU: Philox4x32-10 reference RNG, counter-addressable bootstrap
    - ZQEngine: session actor with use/save/gen/replace/drop/keep/summarize/
      regress/count/list/graph/bootstrap/set seed/xtset/log
    - SwiftUI app (xcodegen): console with history, variables sidebar,
      Swift Charts plots; sandboxed + hardened runtime entitlements
    - Tests: 44 green (parser golden, R fixtures at 1e-10, Philox KAT,
      end-to-end engine); Tests/Fixtures/generate.R; Tests/Bench harness
    - scripts: check_headers.sh + pre-commit hook, make_icns.sh, release.sh
    
    Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
    simon-pierre boucher committed 6 days ago (Aug 5, 2026) · 1 file changed +153