Home Machine Learning Benchmarking Pytest with CICD Utilizing GitHub Motion | by Kay Jan Wong | Mar, 2024

Benchmarking Pytest with CICD Utilizing GitHub Motion | by Kay Jan Wong | Mar, 2024

0
Benchmarking Pytest with CICD Utilizing GitHub Motion | by Kay Jan Wong | Mar, 2024

[ad_1]

Making Pytest benchmark automated, actionable, and intuitive

Photo by Lucas Santos on Unsplash
Photograph by Lucas Santos on Unsplash

“Your code is sluggish” is one thing that’s simply mentioned, however it could take numerous trial and error and testing to seek out out which a part of the code is sluggish, and the way sluggish is sluggish? As soon as the bottleneck of the code is discovered, does it scale nicely with an enter that’s 100 occasions or 1000 occasions bigger, with outcomes averaged throughout 10 iterations?

That is the place pytest-benchmark is useful

Complementing the thought of unit testing, which is to check a single unit or small a part of the codebase, we will develop on this and measure code efficiency simply with pytest-benchmark.

This text will contact on tips on how to arrange, run, and interpret the benchmark timing outcomes of pytest-benchmark. To correctly implement benchmarking in a venture, the superior sections additionally contact on tips on how to examine benchmark timing outcomes throughout runs and reject commits in the event that they fail sure thresholds, and tips on how to retailer and think about historic benchmark timing outcomes in a histogram!

This may merely be accomplished with pip set up pytest-benchmark on the Terminal.

To allow extra options, similar to visualizing the benchmark outcomes, we will carry out pip set up 'pytest-benchmark[histogram]' to put in the extra packages required.

Just like pytest with added benchmark fixture

[ad_2]