ionelmc / pytest-benchmark

py.test fixture for benchmarking code
BSD 2-Clause "Simplified" License
1.22k stars 115 forks source link

skip setup function time #221

Open visheshh opened 2 years ago

visheshh commented 2 years ago

Hi Team,

I have a simple test scenario where I want to measure time taken to add 1k entries and delete 1k entries in the system.

Example: The problem is when i want to measure the time taken to delete the 1000 entries every time i have to add back 1000 entries to the system(so i made adding entries as setup function). and for deletion It takes 0.5 secs to delete but 9.5 secs to add 1k entries and run it 100 rounds and take an average. It measures it as 10 secs, But i want to measure only 0.5 secs. can i skip time measurement of setup function?

Is there a way to skip time taken to run setup function while doing benchmark?

I am open to suggestions ? are there any other ways to do this?