Remove borrowed types from FFI; fixed_size_list constructor accepts u32#8658
Conversation
1e8875f to
c9c7bde
Compare
0ax1
left a comment
There was a problem hiding this comment.
Most importantly. Run under ASAN/leak sanitizer. And double check whether any benchmarks regress (bc we heap allocate now instead of borrowing in some cases).
Merging this PR will improve performance by 10.44%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | compact_sliced[(4096, 90)] |
750 ns | 837.5 ns | -10.45% |
| ❌ | Simulation | chunked_varbinview_opt_canonical_into[(100, 100)] |
305.7 µs | 340.7 µs | -10.25% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[128] |
273.6 ns | 215.3 ns | +27.1% |
| ⚡ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
206 µs | 169.8 µs | +21.3% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
333.9 ns | 275.6 ns | +21.17% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[2048] |
427.8 ns | 369.4 ns | +15.79% |
| ⚡ | Simulation | rebuild_naive |
105.5 µs | 91.5 µs | +15.27% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing myrrc/ffi-no-borrowed (4e93282) with develop (86c250a)
Footnotes
-
4 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. ↩
|
I've reenabled ASAN, and it reports a leak as it should |
c9c7bde to
33efcfa
Compare
Polar Signals Profiling ResultsLatest Run
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals ProfilingVortex (geomean): 0.938x ➖ How to read Verdict and Engines
datafusion / vortex-file-compressed (0.938x ➖, 0↑ 0↓)
No file size changes detected. |
33efcfa to
4e93282
Compare
Benchmarks: FineWeb NVMeVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.956x ➖, 2↑ 0↓)
datafusion / vortex-compact (0.940x ➖, 0↑ 0↓)
datafusion / parquet (0.919x ➖, 2↑ 0↓)
duckdb / vortex-file-compressed (0.933x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.955x ➖, 0↑ 0↓)
duckdb / parquet (0.921x ➖, 2↑ 0↓)
File Size Changes (1 files changed, -0.1% overall, 0↑ 1↓)
Totals:
|
Benchmarks: TPC-H SF=1 on NVMEVerdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.974x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.980x ➖, 0↑ 0↓)
datafusion / parquet (0.949x ➖, 5↑ 1↓)
datafusion / arrow (0.959x ➖, 1↑ 0↓)
duckdb / vortex-file-compressed (0.963x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.953x ➖, 2↑ 0↓)
duckdb / parquet (0.944x ➖, 3↑ 1↓)
duckdb / duckdb (0.988x ➖, 0↑ 0↓)
File Size Changes (9 files changed, -0.1% overall, 2↑ 7↓)
Totals:
|
Benchmarks: TPC-DS SF=1 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.997x ➖, 0↑ 0↓)
datafusion / vortex-compact (1.008x ➖, 0↑ 0↓)
datafusion / parquet (0.998x ➖, 3↑ 2↓)
duckdb / vortex-file-compressed (1.006x ➖, 2↑ 3↓)
duckdb / vortex-compact (1.003x ➖, 0↑ 2↓)
duckdb / parquet (0.998x ➖, 0↑ 1↓)
duckdb / duckdb (0.985x ➖, 3↑ 1↓)
File Size Changes (6 files changed, -0.1% overall, 4↑ 2↓)
Totals:
|
Benchmarks: FineWeb S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.102x ➖, 0↑ 1↓)
datafusion / vortex-compact (0.828x ➖, 2↑ 0↓)
datafusion / parquet (0.993x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.985x ➖, 0↑ 1↓)
duckdb / vortex-compact (0.936x ➖, 0↑ 0↓)
duckdb / parquet (0.954x ➖, 0↑ 0↓)
|
Benchmarks: Statistical and Population GeneticsVerdict: No clear signal (low confidence) How to read Verdict and Engines
duckdb / vortex-file-compressed (1.005x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.998x ➖, 0↑ 0↓)
duckdb / parquet (1.008x ➖, 0↑ 0↓)
File Size Changes (1 files changed, +0.0% overall, 1↑ 0↓)
Totals:
|
Benchmarks: Clickbench Sorted on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.975x ➖, 2↑ 1↓)
datafusion / parquet (0.996x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (1.043x ➖, 0↑ 1↓)
duckdb / parquet (0.980x ➖, 0↑ 0↓)
duckdb / duckdb (0.992x ➖, 0↑ 0↓)
File Size Changes (201 files changed, -0.0% overall, 106↑ 95↓)
Totals:
|
Benchmarks: TPC-H SF=10 on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.943x ➖, 0↑ 0↓)
datafusion / vortex-compact (0.947x ➖, 1↑ 0↓)
datafusion / parquet (0.954x ➖, 0↑ 0↓)
datafusion / arrow (0.917x ➖, 6↑ 0↓)
duckdb / vortex-file-compressed (0.962x ➖, 0↑ 0↓)
duckdb / vortex-compact (0.971x ➖, 0↑ 0↓)
duckdb / parquet (0.980x ➖, 0↑ 0↓)
duckdb / duckdb (0.967x ➖, 1↑ 0↓)
File Size Changes (27 files changed, +0.0% overall, 18↑ 9↓)
Totals:
|
Benchmarks: Clickbench on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.021x ➖, 0↑ 2↓)
datafusion / parquet (1.007x ➖, 0↑ 2↓)
duckdb / vortex-file-compressed (1.023x ➖, 1↑ 5↓)
duckdb / parquet (1.000x ➖, 0↑ 0↓)
duckdb / duckdb (1.002x ➖, 0↑ 0↓)
File Size Changes (104 files changed, -0.0% overall, 38↑ 66↓)
Totals:
|
Benchmarks: TPC-H SF=1 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.068x ➖, 0↑ 3↓)
datafusion / vortex-compact (1.237x ➖, 0↑ 6↓)
datafusion / parquet (1.170x ➖, 1↑ 5↓)
duckdb / vortex-file-compressed (1.100x ➖, 0↑ 1↓)
duckdb / vortex-compact (1.031x ➖, 0↑ 0↓)
duckdb / parquet (1.066x ➖, 0↑ 0↓)
|
Benchmarks: Random AccessVortex (geomean): 1.033x ➖ How to read Verdict and Engines
unknown / unknown (1.029x ➖, 0↑ 5↓)
|
Benchmarks: Appian on NVMEVerdict: No clear signal (low confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (0.989x ➖, 0↑ 0↓)
datafusion / parquet (0.985x ➖, 0↑ 0↓)
duckdb / vortex-file-compressed (0.979x ➖, 0↑ 0↓)
duckdb / parquet (0.977x ➖, 0↑ 0↓)
duckdb / duckdb (0.978x ➖, 0↑ 0↓)
File Size Changes (4 files changed, -0.0% overall, 1↑ 3↓)
Totals:
|
Benchmarks: TPC-H SF=10 on S3Verdict: No clear signal (environment too noisy confidence) How to read Verdict and Engines
datafusion / vortex-file-compressed (1.048x ➖, 0↑ 1↓)
datafusion / vortex-compact (1.062x ➖, 0↑ 1↓)
datafusion / parquet (1.142x ➖, 0↑ 3↓)
duckdb / vortex-file-compressed (1.094x ➖, 0↑ 0↓)
duckdb / vortex-compact (1.107x ➖, 0↑ 0↓)
duckdb / parquet (1.043x ➖, 0↑ 0↓)
|
Benchmarks: CompressionVortex (geomean): 1.005x ➖ How to read Verdict and Engines
unknown / unknown (1.021x ➖, 1↑ 7↓)
|
FFI currently has two types of returned objects: ones are owned (inside of which
there's an Arc), others are borrowed (because there's no Arc inside).
One example of the latter is a struct field name which returns a borrowed
vx_string. We initially had a comment
caller shouldn't call the corresponding _free() function on these. This is not
enough as caller can call a _clone() function on a borrowed vx_string which is
UB because we try to increment a strong reference count on a pointer which isn't
an Arc. From a callee's perspective, we can't distinguish owned and borrowed
types, and this creates weird APIs like struct field dtype being owned but name
being borrowed.
This PR removes all borrowed/owned distinction from FFI layer. Each object now
returned from an FFI function is owned. It can be freely cloned, and each must
be freed explicitly with _free() functions.
On another change, fixed size list constructor previously accepted a size_t
(64-bit unsigned integer on most systems) but validated it against u32 because
that's our file format limitation for fixed size lists. This PR changes the
signature so that now it accepts uint32_t as length parameter.
As the changes are significant enough to trigger bugs in our own tests, this PR also re-enables FFI sanitizer tests in CI.