www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - cpu % usage decreases when (unrelated) memory usage increases

reply "Christiaan" <chvandorp gmail.com> writes:
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
Jan 29 2015
next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
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?
Jan 29 2015
prev sibling parent =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
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
Jan 29 2015