Open
Conversation
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 <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>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
@sbstndb please merge https://github.com/xtensor-stack/xtensor/blob/master/benchmark/benchmark_stl.cpp into your approach! :) Thanks for your contributions! |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a Work in progress
Checklist
Description