Skip to content

New C++ api#8651

Draft
myrrc wants to merge 1 commit into
developfrom
myrrc/cxx2
Draft

New C++ api#8651
myrrc wants to merge 1 commit into
developfrom
myrrc/cxx2

Conversation

@myrrc

@myrrc myrrc commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
  • Replace C++ api with a new one which depends on vortex-ffi.
  • Remove cxx crate from workspace.
  • Port FFI examples and tests to C++ examples as tests.
  • Add a reader/writer guide for C++ api.
  • Run C++ tests with ASAN and run examples in CI.

FFI changes:

  • Add vx_expression_clone
  • Remove accidental const modifier from output from vx_expression_not
  • Fix a memory leak in vx_struct_fields_builder_add_field where a non-UTF8 field throws before DType was converted from a raw pointer to an Arc

@myrrc myrrc added the changelog/break A breaking API change label Jul 3, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 3, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 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.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 2 regressed benchmarks
✅ 1664 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation chunked_varbinview_into_canonical[(1000, 10)] 170 µs 206.1 µs -17.52%
Simulation compare_int_constant 268.4 µs 298.5 µs -10.08%
Simulation chunked_varbinview_canonical_into[(1000, 10)] 190.4 µs 154.5 µs +23.18%
Simulation bitwise_not_vortex_buffer_mut[128] 273.6 ns 244.4 ns +11.93%

Tip

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


Comparing myrrc/cxx2 (347b89d) with develop (dd4ab89)

Open in CodSpeed

Footnotes

  1. 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.

@myrrc myrrc force-pushed the myrrc/cxx2 branch 2 times, most recently from 05babc3 to 5795c45 Compare July 3, 2026 16:35
@myrrc myrrc requested a review from 0ax1 July 3, 2026 16:47
@myrrc myrrc force-pushed the myrrc/cxx2 branch 2 times, most recently from a044015 to a5c7567 Compare July 3, 2026 16:56
@myrrc myrrc added the lang/cpp Relates to the Vortex C++ API label Jul 7, 2026
@myrrc myrrc force-pushed the myrrc/cxx2 branch 8 times, most recently from 66bfb31 to de2512a Compare July 8, 2026 14:07

@0ax1 0ax1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass

Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/ci.yml
Comment thread vortex-cxx/vortex.hpp Outdated
Comment thread vortex-cxx/.clang-format Outdated
Comment thread vortex-cxx/vortex.hpp Outdated
Comment thread vortex-cxx/vortex.hpp Outdated
Comment thread vortex-cxx/vortex.hpp Outdated
* Estimated count. Throws if not known(). For inexact estimates this is
* is an upper bound.
*/
uint64_t value() const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this API. Why not just have value? What's the flow when the caller passes in the fallback. And why does that need to handled in a method of Estimate?

Comment thread vortex-cxx/vortex.hpp Outdated

// List accessors. Valid only on List and FixedSizeList dtypes

DataType list_element() const;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every public fn in this PR added needs docs.

Comment thread vortex-cxx/vortex.hpp Outdated
@vortex-data vortex-data deleted a comment from github-actions Bot Jul 8, 2026

@0ax1 0ax1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

second pass

Comment thread vortex-cxx/examples/.clang-tidy
Comment thread vortex-cxx/examples/dtype.cpp
Comment thread vortex-cxx/examples/hello-vortex.cpp Outdated
Comment thread vortex-cxx/tests/CMakeLists.txt

private:
void reset() noexcept {
if (!path_.empty()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about checking the error in tests?

Comment thread vortex-cxx/vortex.cpp Outdated
return BytesView(std::move(canonical), std::move(validity), n);
}

Array make_struct(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why actually not && in the signature for the return type?

Comment thread vortex-cxx/vortex.cpp Outdated
}

void StructArrayBuilder::Deleter::operator()(
vx_struct_column_builder* ptr) const noexcept {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our rule of thumb for sprinkling noexcept?

Comment thread vortex-cxx/vortex.cpp Outdated
Comment thread vortex-cxx/vortex.cpp Outdated
}
session_ = std::move(other.session_);
stream_ = other.stream_;
other.stream_ = ArrowArrayStream{};

@0ax1 0ax1 Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here we do why change other? other.stream_ = ArrowArrayStream{};

Comment thread vortex-cxx/vortex.hpp Outdated
@myrrc myrrc requested a review from 0ax1 July 10, 2026 14:19
Signed-off-by: Mikhail Kot <mikhail@spiraldb.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change lang/cpp Relates to the Vortex C++ API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants