feat: [WIP] New benchmarks by sbstndb · Pull Request #2883 · xtensor-stack/xtensor
and others added 6 commits
January 7, 2026 23:33Add 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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
sbstndb
changed the title
feat: New benchmarks
feat: [WIP] New benchmarks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters