← Back to Pull requests

bench(perf-matrix): GeoJSON, GeoJSONSeq and CSV reads against GDAL #1436

Open
unknown opened this pull request with 650 lines diff across 8 files
View on GitHub
unknown unknown commented on Nov 30, 2026 15:10 UTC
Author

The performance matrix (scripts/perf_matrix.py) now compares terrio's GeoJSON, GeoJSON text sequence and CSV reads with GDAL's: three formats, geojson, geojsonseq and csv, each with polygon, point and line files, read whole through terrio.open_stream and through terrio.open_vector, and by two columns, from a local path and over HTTP. /perf-matrix geojson (or geojsonseq, csv) runs them on a pull request, the default /perf-matrix includes them, and changes to their readers select them in perf_matrix.py touched.

Part of #1273 ("GeoJSON / GeoJSONSeq, CSV: full reads, streaming").

What was added

  • GeoJson, with GeoJsonSeq and Csv as subclasses (driver, extension, creation and open options), registered in FORMATS with PATHS entries (the GeoJSON or CSV reader, wkt.rs for CSV, the eager read in drivers/vector/mod.rs and dataset.rs, the stream, Arrow export and bindings).

  • Fixtures: GDAL 3.13.3 translations of the first features of the vector sources the other vector formats use: 100,000 polygons, 500,000 points, 100,000 lines (28 to 86 MB of text). GeoJSON keeps the sources' UTM coordinates (EPSG:32631); GDAL writes GeoJSON text sequences in WGS 84; CSV stores the geometry as WKT in a WKT column (GEOMETRY=AS_WKT).

  • Accesses: full (every column through terrio.open_stream), eager (every column through terrio.open_vector) and columns (the geometry and two attributes through open_stream). GDAL reads all three with pyogrio.read_arrow, a CSV with AUTODETECT_TYPE=YES, terrio's default. Values are compared by digest, as for the other vector formats; for CSV both tables keep the WKT column as text. Every read needs the whole file: text has no index or columnar layout.

  • perf-matrix.yml accepts the three formats and runs them with the read formats; docs/benchmarks.md describes them.
  • Results

    --samples 3 on an i9-14900K (32 CPUs, 61 GB, Linux), terrio 0.10.0 (release wheel of main at 9192c841), GDAL 3.13.3, pyogrio 0.13.0, 4 threads, 20 ms simulated round trip over HTTP. The machine was shared with other work (/proc/loadavg 6–38 across the runs), so time ratios are provisional; bytes, requests and values are not.

    All 54 cases are exact (equal digests). Geometric means of terrio/GDAL time:

    | Format | all | local | HTTP | full | eager | columns |
    |---|---:|---:|---:|---:|---:|---:|
    | geojson | 0.54 | 0.45 | 0.65 | 0.45 | 0.77 | 0.46 |
    | geojsonseq | 0.16 | 0.17 | 0.15 | 0.15 | 0.18 | 0.15 |
    | csv | 0.78 | 1.26 | 0.48 | 0.75 | 0.76 | 0.84 |

    Whole reads (full):

    | Fixture | Source | terrio ms | GDAL ms | terrio/GDAL | KiB t/G | Need KiB | Requests t/G | Peak RSS MB t/G |
    |---|---|---:|---:|---:|---:|---:|---:|---:|
    | GeoJSON polygons | local | 387 | 1,486 | 0.26 | 137,718 / 137,732 | 68,859 | | 229 / 177 |
    | GeoJSON polygons | http | 1,814 | 3,062 | 0.59 | 68,859 / 137,718 | 68,859 | 2 / 69 | 1,981 / 199 |
    | GeoJSON points | local | 686 | 1,954 | 0.35 | 177,649 / 177,663 | 88,824 | | 162 / 173 |
    | GeoJSONSeq polygons | local | 233 | 1,912 | 0.12 | 95,950 / 95,969 | 47,975 | | 230 / 165 |
    | GeoJSONSeq points | http | 853 | 4,371 | 0.20 | 81,456 / 162,913 | 81,456 | 2 / 79 | 408 / 169 |
    | CSV polygons | local | 464 | 434 | 1.07 | 62,191 / 31,571 | 30,583 | | 269 / 220 |
    | CSV points | local | 743 | 564 | 1.32 | 63,157 / 32,054 | 31,066 | | 183 / 167 |
    | CSV points | http | 844 | 1,569 | 0.54 | 31,066 / 31,082 | 31,066 | 2 / 26 | 308 / 181 |

    Findings:

  • CSV on disk: terrio reads the file twice (a type-detection pass over the whole file, then the read) and takes 1.07–1.36x GDAL's time; GDAL detects types from the first megabyte (AUTODETECT_SIZE_LIMIT). This is stated in the docs as a difference in work, not hidden by matching options.

  • Over HTTP: terrio's open_stream streams local files only; a URL is downloaded whole in 2 requests and read eagerly, so full and eager time the same path there. For GeoJSON that peaks at 1.8–2.7 GB against GDAL's 0.2 GB. GDAL transfers GeoJSON and GeoJSONSeq files twice (2x the bytes) in 50–85 range requests.

  • Local GeoJSON/GeoJSONSeq: both tools read the file twice (schema, then features); terrio's eager open_vector peaks at 1.0–1.4 GB on GeoJSON against GDAL's 0.17 GB.
  • Limitations

  • Whole and column reads only: no bbox reads (text has no index, so a bbox read is a whole read with a filter), and smaller fixtures than the binary formats' (text is about three times larger).

  • /perf-matrix runs with the base branch's harness, so it measures these formats on pull requests after this one is merged.

  • The workflow line and touched test assertions listing formats are also edited by the other perf-matrix pull requests; whichever merges later needs a trivial conflict resolution.
  • Validation

  • pytest scripts/tests/test_perf_matrix.py (GDAL 3.13.3 environment): 110 passed.

  • Local reviews (CI review prompt, correctness review, standards/spec review); findings fixed or answered.
  • 🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Performance matrix requests now support GeoJSON, GeoJSONSeq, and CSV formats. These formats are also included in the default selections and in selections made when options are provided without a format.
    Documentation
    Benchmark documentation now describes read cases and format-specific behavior for GeoJSON, GeoJSONSeq, and CSV. It also clarifies how text inputs are read and how streaming and type detection differ between tools.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: coderabbitai[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.37 = Change Risk (0.52) × (1 − Review Confidence (0.29)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 47% · Reviewer familiarity: 35%
    29%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #1436"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 29.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 29.2% · Lower = rushed or shallow review
    29.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 36.8% · Moderate risk
    36.8%