Thread overview
cpu % usage decreases when (unrelated) memory usage increases
Jan 29, 2015
Christiaan
Jan 29, 2015
Adam D. Ruppe
Jan 29, 2015
Ali Çehreli
January 29, 2015
Dear reader,

I have a class X that has a (possibly) heavy array of data S as a member. A method f of X makes use of a foreach loop over taskPool(some_other_array Y).
The thing is that when I increase the length of S, linux/top shows me that my D program only uses 10% of my cpu capacity. This percentage varies with the length of S. From my perspective, S has nothing to do with X.f. Can someone please explain what might be the issue here?

regards, Chris
January 29, 2015
Can you post any of the code itself? My guess would be that something is being cached by the processor - is the code itself faster or slower when the cpu changes?
January 29, 2015
On 01/29/2015 12:33 PM, Christiaan wrote:

> Can someone please explain what might be the issue here?

If the memory is too large, needing to be swapped to and from disk, then your program may be waiting for I/O instead of doing actual work.

Ali