Re:Measure code execution time accurately in Python
by cscheid on Saturday January 18, 2020 @01:31PM
(#22086071)
You make a good point I hadn't considered. In that case, not even robust least squares will save you, because the samples are not independent of one another. You'd have to start looking into explicit time-dependent methods and yikes, I have no idea of what the literature says about time dependence and outliers. I wouldn't be surprised if it's "here be dragons" territory.
Re:Measure code execution time accurately in Python
by gdxhyrd on Saturday January 18, 2020 @02:06PM
(#22086338)
You are speaking as a stats person. :)
While there are dozens of things that can go south in benchmarking, how to solve them is not about applying advanced stats, but about understanding and eliminating the sources of noise.
Most benchmarks in CS can be done quite easily as long as one understands all the technology stack.
Re:Measure code execution time accurately in Python
by cscheid on Saturday January 18, 2020 @02:50PM
(#22086652)
I'm not a stats person! But I have been burned in real projects by doing the wrong thing. I just have learned --- the hard way --- to honestly appreciate it.
Re:Measure code execution time accurately in Python
by colmmacc on Saturday January 18, 2020 @01:59PM
(#22086278)
Speculative execution optimizations, e.g. branch prediction, are even data dependent. It's a very complex measurement space!
2, 3, 4 function calls in a row will benefit from that caching, but also help train the speculative execution engine. At some point that speculation may radically alter performance. Later, with a sufficient number of runs, the timing will also suffer from preemption, context-switches, or other interruptions that can invalidate both the cache and the speculative execution engine.
The idea that there is a fixed performance time for a function is naive on modern hardware.