Skip to content

BENCH: Add benchmarks targeted at small arrays #21463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 11, 2022

Conversation

eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented May 6, 2022

This PR adds a benchmark file specifically targeted at small arrays and scalars.

The goal is to benchmark the overhead of the various numpy methods. For benchmarks with large arrays (e.g. size > 1e6) the overhead is small compared to the actual computation, but for small arrays it is not.

@eendebakpt eendebakpt marked this pull request as draft May 6, 2022 11:29
@seberg seberg changed the title PERF Add benchmark targeted at small arrays BENCH: Add benchmarks targeted at small arrays May 6, 2022
@mattip
Copy link
Member

mattip commented May 7, 2022

Rather than create new benchmarks, could we extend the current ones with smaller arrays?

@eendebakpt eendebakpt force-pushed the benchmark_small_arrays branch from bae9511 to 44a7e37 Compare May 10, 2022 08:53
@eendebakpt
Copy link
Contributor Author

Rather than create new benchmarks, could we extend the current ones with smaller arrays?

Sure. I moved them into the existing benchmarks. Let me know if I should move them to some other location or if some of tests are added are redundant. @mattip


def time_mean_axis(self):
np.mean(self.array_4_5, axis=1)


Copy link
Member

Choose a reason for hiding this comment

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

It turns out we do not bencmark np.mean. I think this belongs in bench_functions_base.py, since that is where median, percentile and other numeric functions are checked.

@eendebakpt eendebakpt force-pushed the benchmark_small_arrays branch from 44a7e37 to 2534a7c Compare May 10, 2022 12:20
@eendebakpt eendebakpt marked this pull request as ready for review May 10, 2022 13:06
@mattip mattip merged commit 59dd378 into numpy:main May 11, 2022
@mattip
Copy link
Member

mattip commented May 11, 2022

Thanks @eendebakpt

@eendebakpt eendebakpt deleted the benchmark_small_arrays branch May 14, 2022 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants