Skip to content
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

calculation of average duration #11

Closed
FObersteiner opened this issue Nov 1, 2023 · 1 comment · Fixed by #12
Closed

calculation of average duration #11

FObersteiner opened this issue Nov 1, 2023 · 1 comment · Fixed by #12

Comments

@FObersteiner
Copy link
Collaborator

at the moment, the average execution time is calculated by using self.totalOperations of the Benchmark instance.

If I'm not mistaken, this gives invalid results since the number of ops is incremented in multiple places; here and here - additionally, the user-side code can increment it by calling b.incrementOperations(1), as in your 'basic' example.

This seems a bit like a separation-of-concerns thing; as a clean solution why not use self.durations.items.len as denominator ?

@hendriknielaender
Copy link
Owner

Thank you. You're correct, incrementing self.totalOperations in multiple places can lead to inconsistent or incorrect results when calculating the average execution time, especially when b.incrementOperations(1) is also called in the user-side code.

I've created a Pull Request to implement this change. Feel free to review and provide any feedback.

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 a pull request may close this issue.

2 participants