Skip to content

Conversation

@sbstndb
Copy link
Contributor

@sbstndb sbstndb commented Jan 8, 2026

This is a Work in progress

  • bring comparison benchmarks to Xtensor (C++, Eigen, ...)

Checklist

  • The title and commit message(s) are descriptive.
  • Small commits made to fix your PR have been squashed to avoid history pollution.
  • Tests have been added for new features or bug fixes.
  • API of new functions and classes are documented.

Description

sbstndb and others added 6 commits January 7, 2026 23:33
Add optional comparison benchmarks that directly compare xtensor
performance against raw C++ implementations. This helps users
understand the performance characteristics and overhead of xtensor.

Changes:
- Add XTENSOR_BUILD_COMPARISON_BENCHMARKS CMake option (OFF by default)
- Add benchmark/comparison/ directory with BLAS1 comparisons
  - add_vector: z = x + y (vector + vector)
  - add_scalar: z = x + a (vector + scalar)
  - mul_scalar: y = a * x (scalar * vector)
- Each benchmark compares raw C++ vs xtensor (xarray, xtensor, noalias)

Usage:
  cmake .. -DXTENSOR_BUILD_COMPARISON_BENCHMARKS=ON
  make benchmark_comparison
  ./comparison/benchmark_comparison

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Reduce code duplication and improve readability:
- Add helper functions for xtensor/xarray creation
- Add BENCHMARK_LOOP macro to reduce boilerplate
- Add REGISTER_BENCHMARK macro for standard sizes
- Rename: raw_cpp → std, shorten xtensor variants
- Add size 8 to benchmark ranges
- Use constexpr for scalar values

Changes:
- blas1_comparison.cpp: 211 → 197 lines (-14 lines)
- Add min_size=8, max_size=16384, multiplier=4 constants
- Simpler, more maintainable code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@sbstndb sbstndb changed the title feat: New benchmarks feat: [WIP] New benchmarks Jan 8, 2026
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