-
Notifications
You must be signed in to change notification settings - Fork 448
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
Add performance benchmark #181
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
What are your thoughts @domanchi? Figured you might not like extra-dependency (monotonic
), but we can't drop Python 2 until a future point in time.
@dgzlopes Is there a reason why this needs to be integrated into the main package? I'm thinking an adhoc script should suffice, because this is more for package testing, rather than end user consumption. |
Makes sense, I'd agree with that. |
@domanchi I thought that maybe integrating the base benchmarking functionality, would make easier to add in the future the per plugin/file benchmarks proposed in #130 (comment). Also for the users, may be interesting to know the time elapsed if they run detect-secrets on an automated way. On the other hand, following the ad-hoc way I understand that It would be a small script that starts the timer, runs detect-secrets and then returns the elapsed time. But if we just want this, maybe it is better to follow the Unix principles and rely on the time command [0] (or in windows the Measure-Command) so there is no need for some project-specific script. |
We could do that too. When I think of performance bench-marking, I think of the following questions:
There's no caching, so speed should remain relatively consistent between consecutive runs. Furthermore, because this tool is somewhat fast, I doubt there will be much information if we do a complete file speed breakdown (because the majority of files are small, and therefore, won't produce any reasonable timings to work with). With these questions in mind, these are the objectives I envision for minimal performance bench-marking:
With these objectives, we could do the Apologies for not being clearer in the original issue. Hopefully this provides more direction for this added testing capabilities. Thanks for helping empower the community to be able to make better changes by having a scientific way to measure the impact on performance! |
First, thanks for the time and the nice writeup @domanchi ! Now I know I was missing the point with the first PR. I have updated the PR today adding a new benchmark script (and cleaned the past commits) and would love If you have some time for giving it a spin. I want to note that this is just an update and It's still a WIP (missing some testing, comments and I'm sure that more things!) and for the moment only basic functionality is included:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking a lot better!
I like your output style, and general output. Couple of bugs and stylistic changes, but almost good for a v1! We'd be happy to run this on our internal data to get an average current performance when this is merged.
Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com> Fix Spacing Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com> Add benchmark script Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com> Fix performance benchmark Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com> Fix val len Signed-off-by: Daniel González Lopes <danielgonzalezlopes@gmail.com>
d5a54c2
to
6ed2b1d
Compare
Squashed all the commits for a cleaner git log! 😊 |
* Use GHDetectorV2 Supports git-defenders/detect-secrets-discuss#166 * Fix pre-commit (hopefully)
* Use GHDetectorV2 Supports git-defenders/detect-secrets-discuss#166 * Fix pre-commit (hopefully)
Signed-off-by: Daniel González Lopes danielgonzalezlopes@gmail.com
Added performance benchmark for the scan stage as said on #130. Is the startTimeMeasurement() on the proper place?
On the other side, I had to use an external monotonic [0] package as monotonic it's only avaliable on Python 3.3+ [1].
[0] https://github.com/atdt/monotonic
[1] https://docs.python.org/3/library/time.html