3 ms·
Please don’t make benchmarks with timing inside the loop creating a sum. Just time the loop and divide by the number. Stuff happens getting the time and the jit
by sroussey 1y ago
Please don’t make benchmarks with timing inside the loop creating a sum. Just time the loop and divide by the number. Stuff happens getting the time and the jitter can mess with results.
- 8organicbits 1y agoI'll plug timeit, from the standard library as a good approach. https://docs.python.org/3/library/timeit.html https://docs.python.org/3/library/timeit.html
- mjevans 1y agoThe real world benchmark is measuring it from invocation, both for cold launches and 'hot' (data cached from the last run). Interestingly I might have only ever used the time (shell) builtin command. GNU's time measuring command prints a bunch of other performance stats as well.
- rocqua 1y agoI'm annoyed every time I have to write $(which time). But the stats given by -v are just so much more valuable from gnu-time.
- Tom1380 1y agoWouldn't it also work with "env time" if that's easier to type?
- deleted 1y ago[deleted]
- aaronmdjones 1y agoIt would also work to just write 'time' Quoting overrides aliases and builtins. $ 'time' -v -- echo hi hi Command being timed: "echo hi" [...]
- janc_ 1y agoThe easiest to type is to make a 'time' alias (or shell function in fish, or whatever your shell prefers…)