I have a python script (running under Linux fwiw) that I want to speed up by rewriting some bottleneck parts in different ways to see which one is better/faster.
I can measure the runtime or instrument it with cProfile, but the problem is that I am using a modern laptop/cpu. The runtime from run to the next is changing by as much as 5% - which is, as far as I can tell, due to various forms of CPU throttling (Temperature / Power).
This makes it very hard to check actual code performance differences. Is there some way to compensate for this and/or easily measure actual work done by the CPU?