Skip to content

Execute spatial distance with RowFn - #9349

Draft
connortsui20 wants to merge 3 commits into
ct/row-fn-tensor-productsfrom
ct/row-fn-spatial-distance
Draft

Execute spatial distance with RowFn#9349
connortsui20 wants to merge 3 commits into
ct/row-fn-tensor-productsfrom
ct/row-fn-spatial-distance

Conversation

@connortsui20

@connortsui20 connortsui20 commented Aug 11, 2026

Copy link
Copy Markdown
Member

Rationale for this change

Moves spatial distance to the shared row executor. Each geometry column decodes once per batch, and a constant operand remains one decoded geometry.

What changes are included in this PR?

Adds the crate-private GeometryRow input element and expresses distance as a two-row kernel. Tests cover both constant positions, nullable inputs, mixed geometry types, and exact distance behavior.

Rust 1.97.1 one-CGU fat-LTO measurements keep the ordinary distance cases within 2.7% of develop; the nullable column-by-constant case improves by 13.9%.

What APIs are changed? Are there any user-facing changes?

There are no public API or behavior changes. SpatialDistance implements RowFn and receives the standard scalar-function vtable automatically.

@codspeed-hq

codspeed-hq Bot commented Aug 11, 2026

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 2049 untouched benchmarks
⏩ 89 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
WallTime words_gather_scalar[65536] 8.3 µs 9.4 µs -11.93%
Simulation nullable_point_column_x_constant_point 758.3 µs 666 µs +13.85%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ct/row-fn-spatial-distance (8f44a47) with ct/row-fn-tensor-products (5f4a145)

Open in CodSpeed

Footnotes

  1. 89 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from fadcf1d to 46c63e4 Compare August 11, 2026 16:04
@connortsui20
connortsui20 marked this pull request as ready for review August 11, 2026 16:05
@connortsui20
connortsui20 marked this pull request as draft August 11, 2026 16:24
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 46c63e4 to 450326d Compare August 11, 2026 17:12
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch 2 times, most recently from 788ce5f to bba41db Compare August 11, 2026 19:36
@connortsui20

Copy link
Copy Markdown
Member Author

Here are the local spatial-distance benchmark results from the final Rust 1.97.1 run.

The comparison used a develop baseline with benchmark-only backfills (1edd0fca) and the full RowFn stack (8ca9fc73). Later stack layers do not change spatial distance source, but unrelated code-placement effects can still affect these binaries.

The machine was an AMD Ryzen 9 7950X running Linux. The build used rustc 1.97.1, LLVM 22.1.6, one CGU, fat LTO, and -C target-cpu=native. Each target used two warm runs and seven alternating measured pairs. Each process used 100 samples with a 0.25–0.5 second measurement window on CPU 4.

Negative changes are faster. The values are medians across the seven paired runs.

The three ordinary distance cases remain within 2.65%. The nullable column-by-constant case improves by 13.85%.

All spatial-distance results: 4 cases
Benchmark Baseline RowFn stack Change
point_column_x_constant_point 13.670 µs 14.080 µs +2.65%
polygon_column_x_constant_polygon 33.550 µs 34.180 µs +1.70%
point_column_x_point_column 17.140 µs 17.060 µs +0.47%
nullable_point_column_x_constant_point 18.190 µs 15.680 µs -13.85%

@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from bba41db to 1ef5b2a Compare August 12, 2026 15:24
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 1ef5b2a to 37eb0be Compare August 12, 2026 17:53
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 37eb0be to 949e266 Compare August 12, 2026 18:10
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 949e266 to 268574a Compare August 12, 2026 18:46
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch 2 times, most recently from e5fcac1 to b297e14 Compare August 12, 2026 20:26
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from b297e14 to e62daf9 Compare August 12, 2026 20:50
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from e62daf9 to 29bc76d Compare August 12, 2026 21:03
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 29bc76d to 0a1ca9b Compare August 12, 2026 23:32
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 force-pushed the ct/row-fn-spatial-distance branch from 0a1ca9b to 8f44a47 Compare August 13, 2026 14:45
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