From 68a21c5a5952913d6192be747efd245887bc36cc Mon Sep 17 00:00:00 2001 From: Alexis Placet <2400067+Alex-PLACET@users.noreply.github.com> Date: Thu, 30 Apr 2026 13:24:54 +0200 Subject: [PATCH 1/3] Fix substring calculation in CSV cell parsing and add lexical_cast for signed and unsigned char --- include/xtensor/io/xcsv.hpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/xtensor/io/xcsv.hpp b/include/xtensor/io/xcsv.hpp index 080ccaf54..2fd347745 100644 --- a/include/xtensor/io/xcsv.hpp +++ b/include/xtensor/io/xcsv.hpp @@ -66,7 +66,7 @@ namespace xt } size_t last = cell.find_last_not_of(' '); - return cell.substr(first, last == std::string::npos ? cell.size() : last + 1); + return cell.substr(first, last == std::string::npos ? cell.size() : last - first + 1); } template <> @@ -93,6 +93,18 @@ namespace xt return std::stoi(cell); } + template <> + inline signed char lexical_cast(const std::string& cell) + { + return static_cast(std::stoi(cell)); + } + + template <> + inline unsigned char lexical_cast(const std::string& cell) + { + return static_cast(std::stoul(cell)); + } + template <> inline long lexical_cast(const std::string& cell) { From 9c0bdc8aa57adbc1ea57378f7b00ab08d211308e Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Thu, 28 May 2026 15:22:23 +0200 Subject: [PATCH 2/3] Use codspeed runner and limit who can launch the codspeed workflow --- .github/workflows/codspeed.yml | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 9e2c5999c..5b04a70f2 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -2,17 +2,20 @@ name: CodSpeed on: push: - branches: [master] - pull_request: - # Allow CodSpeed to trigger backtest performance analysis + branches: [ master ] + pull_request: # Allow CodSpeed to trigger backtest performance analysis + issue_comment: + types: [created] + workflow_dispatch: + permissions: contents: read id-token: write concurrency: - group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.job }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }} cancel-in-progress: true defaults: @@ -22,10 +25,19 @@ defaults: jobs: benchmarks: name: Run benchmarks - runs-on: ubuntu-latest + runs-on: codspeed-macro + if: | + github.event_name != 'issue_comment' || + (github.event.issue.pull_request && + contains(github.event.comment.body, '/run-benchmarks') && + (github.event.comment.author_association == 'OWNER' || + github.event.comment.author_association == 'MEMBER' || + github.event.comment.author_association == 'COLLABORATOR')) steps: - name: Checkout code uses: actions/checkout@v6 + with: + ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || github.ref }} - name: Set conda environment uses: mamba-org/setup-micromamba@main @@ -41,11 +53,11 @@ jobs: -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ -DBUILD_BENCHMARK=ON \ -DXTENSOR_USE_XSIMD=ON \ - -DCODSPEED_MODE=simulation + -DCODSPEED_MODE=walltime cmake --build build --target benchmark_xtensor --parallel 8 - name: Run benchmarks uses: CodSpeedHQ/action@v4 with: - mode: simulation + mode: walltime run: ./build/benchmark/benchmark_xtensor From 2d08eb600e1cd9c24a9e1c4f23ee37ec91596353 Mon Sep 17 00:00:00 2001 From: Alexis Placet Date: Thu, 28 May 2026 16:17:17 +0200 Subject: [PATCH 3/3] fix format --- .github/workflows/codspeed.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index 5b04a70f2..a1e1e9142 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -2,7 +2,7 @@ name: CodSpeed on: push: - branches: [ master ] + branches: [master] pull_request: # Allow CodSpeed to trigger backtest performance analysis issue_comment: types: [created]