Repository navigation
Timeit same units - #15485
Timeit same units#15485mina375 wants to merge 4 commits into
Conversation
|
Thanks, as for my first comment in the issue, I'm still unsure this is the right approach as when there are many order of magnitude this becomes unreadable with too many zeros in front, and other people have asked ofr other changes like not using stddev... etc. So I'd like to find a better solution instead of just blindly trying to fix the linked issue, |
|
Thank you for the comment. |
|
hum, maybe that could work. I was also thinking we could also maybe use 10x(exponent multiple of 3) when relevant; which would keep the same unit but make it easier to read. In general even if this goes in or not: i still encourage you to try to build it as an extension. in particular i believe this is often also use to compare multiple then a %timit-graphagic that would automatically collect all the recent result and compare them in say a box plot (or violin plot) I never took the time to actually think and implement that; and would likely not do it in core ipython. But as an extension that would be great; it could also fold into it a bunch of other type of measurement (memory; number of cores...) advantage of an extension is it can update and experiment faster than core and if stable enough we can make it a dependency one day. |
|
Thank you for the reply. |
Summary
Modified the format of the time to be the same unit between the mean and deviation
Before:
1.28 ms ± 37 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
After:
1.28 ± 0.0134 ms per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
I checked that the new test fails without the change in
execution.py.Code changes
_format_time()into a small helper function_time_unit(). The behavior of_format_time()is not changed.TimeitResult.__str__()uses the same unit selected for the mean for both values.References
Refs #14489
AI usage
Checklist