Skip to content

Conversation

@ajpotts
Copy link
Contributor

@ajpotts ajpotts commented Jan 28, 2026

Improve flatten benchmark by:

  • Creating a new variable trimmed_N, so that N will not differ from pytest.N.
  • Removes the flatten benchmark from the benchmark.ini, as it has been moved to the optional folder.
  • Adds the shape_type to the benchmark.extra_info["description"].

@codecov
Copy link

codecov bot commented Jan 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@7ca420c). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #5360   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         5           
  Lines           ?       115           
  Branches        ?         0           
========================================
  Hits            ?       115           
  Misses          ?         0           
  Partials        ?         0           
Flag Coverage Δ
python-coverage 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ajpotts ajpotts force-pushed the flatten_benchmark_improvements branch from 47f38fa to 0d2f984 Compare January 29, 2026 15:10
@ajpotts ajpotts force-pushed the flatten_benchmark_improvements branch from 0d2f984 to 8067701 Compare January 30, 2026 18:40
@ajpotts ajpotts marked this pull request as ready for review January 30, 2026 18:40
N = int(np.round(np.sqrt(N)) ** 2)
trimmed_N = int(np.round(np.sqrt(N)) ** 2)
sqrt_N = int(np.sqrt(N))
shape = (sqrt_N, sqrt_N)
Copy link
Contributor

@drculhane drculhane Feb 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment only, since what I'm about to point out is old code, not your change.

The multiple calls to np.sqrt, and the unneeded call to np.round, bother me. I would rewrite this as:

sqrt_N = int(np.sqrt(N))
trimmed_N = sqrt_N * sqrt_N
shape = (sqrt_N, sqrt_N)

But it certainly works as written, and one extra call to np.sqrt isn't going to noticeably affect the benchmark run time, so ... comment only.

Since this isn't meant to be something that requires resolution, feel free to resolve it yourself as you see fit.

Copy link
Contributor

@drculhane drculhane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix. I left a comment, but it's purely a comment on the code that predates this change. It wasn't meant to require resolution.

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.

2 participants