News for hackers. Stuff that matters.
Re:Potato paradox by jakobegger on Thursday July 16, 2015 @03:36AM (#9895850)
This is an interesting observation, and confirms the way I optimise code:

1) Create a benchmark (some code that performs the task that I want to optimise), and measure the absolute time it needs.

2) Use a profiler to see where most of the time is spent. Optimise that code.

3) Run benchmark to see if your optimisation are effective.

Or, in other words: the percentage tells you where to focus your effort. The absolute time tells you how successful your optimisation is.

Re:Potato paradox by ot on Thursday July 16, 2015 @08:34AM (#9896773)
This is the obvious strategy, but it's not always applicable.

For example when profiling a long-running service, or a kernel, there's no "absolute time it needs", you need other proxies of running time such as the CPU usage percentage, but even that is not noise-free.

So if you just run "perf" on it, you need to be aware of this fallacy.

Re:Potato paradox by blueblob on Thursday July 16, 2015 @09:41AM (#9897068)
I am pretty much a novice in program optimization, but doesn't `perf` sample clock cycles? So in effect CPU usage percentage doesn't matter as much since it's not using wall clock time?