Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: New benchmarks#5

Open
sbstndb wants to merge 6 commits into
masterfrom
new_benchmarks
Open

feat: New benchmarks#5
sbstndb wants to merge 6 commits into
masterfrom
new_benchmarks

Conversation

@sbstndb

@sbstndb sbstndb commented Jan 8, 2026

Copy link
Copy Markdown
Owner

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]>
πŸ€– Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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