-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
WIP: Enable line profiling during pytest #10756
Conversation
This is great @larsoner! |
Amazing! |
How long does the line profiling take? Just to make sure that we don't add much overhead... |
neat ! @larsoner did you take this from somewhere? I think this would be very useful in the wider ecosystem. |
The overhead seems to be negligible in testing so far
Not really, I took the printing bits from This PR already breaks some stuff like our TL;DR: I agree it would be nice but it would be difficult to make it more broadly applicable I think |
@larsoner this has all green CIs but you've recently marked as WIP. Is there more to do here? |
Yeah, not all tests pass when running in profile mode, which I'd like to fix |
Thanks to @cbrnr in mne-tools/mne-qt-browser#161 (comment) I think we don't need this. Profiling on OSX is kind of a pain because you need
With nice config options, line-by-line vs function-level, total-including-children versus owntime, etc. This should be more easily doable on Linux and Windows, too. So I'll close this! |
Todo:
Should help with #10704. Use cProfile -- adapting kernprof/line_profiler code -- to:
pytest
mne
functions that are 1) decorated withverbose
(which is a lot of them) and 2) take at least 1 sec during the testsLocally I get for example this output, first what we have in
main
:Output in main (unchanged)
Followed by the new stuff:
I think across these three types of profiling output, it might be easier to find slow things to optimize.
I think this could probably be merged as-is and iterated over. The only change to core code is a
try/except
that should add negligible time (I hope).