Hi all!

I experiment a very strange behaviour with one of my CF2 function.
In my program a function is called 256 times in a "for" loop. This function
fills some arrays and compute binary paths.
I noticed that the whole loop was very slow, so I checked the execution time
of each function call. The result is wierd : sometimes the function takes a
few milliseconds to complete, and sometimes it takes up to 1 second!
I first reduced the whole execution time by reducing the amount of memory
taken. This way I gained almost 30s! But the whole loop (256 function calls)
is still taking 10+ seconds to complete... (the same eVC4/c++ computing on a
WM2003 PDA takes 4 seconds to complete)
I noticed that with the first version of the program, with no optimization
of the memory, the number of loops that took 1 second was around 40 times.
When I reduced the memory taken by the program, the number of 1 second loops
was around 10. So it seems obvious that the time taken by each call depends
on the available memory.
Is there something with the garbage collector or anything else that could
slow down my function ? Anyone got an idea about it ?

Thank you for your help!

JL

PS : the program takes up to 6.5 MB, the 256 function calls increase the
taken memory from about 3.5 MB to 6 MB.
PPS : the indexes of the calls that take 1 second to complete aren't always
the same, but the more the function have already been called, the more a 1
second loop occurs...

Re: fonction execution time from 0 to 1s!!! by ctacke/>

ctacke/>
Sat May 20 07:57:16 CDT 2006

Well since you didn't actually show us the code, it's pure speculation, but
my bet is that you're doing something poorly with memory management. The
long runs likely are when the GC has to do a full collection and possibly a
compaction. Understanding how memory management in the CF actually works
would go a long way toward you understanding the situation.

-Chris


"JL" <jlgarbage@wanadoo.fr> wrote in message
news:en6QZy0eGHA.2076@TK2MSFTNGP04.phx.gbl...
> Hi all!
>
> I experiment a very strange behaviour with one of my CF2 function.
> In my program a function is called 256 times in a "for" loop. This
> function fills some arrays and compute binary paths.
> I noticed that the whole loop was very slow, so I checked the execution
> time of each function call. The result is wierd : sometimes the function
> takes a few milliseconds to complete, and sometimes it takes up to 1
> second!
> I first reduced the whole execution time by reducing the amount of memory
> taken. This way I gained almost 30s! But the whole loop (256 function
> calls) is still taking 10+ seconds to complete... (the same eVC4/c++
> computing on a WM2003 PDA takes 4 seconds to complete)
> I noticed that with the first version of the program, with no optimization
> of the memory, the number of loops that took 1 second was around 40 times.
> When I reduced the memory taken by the program, the number of 1 second
> loops was around 10. So it seems obvious that the time taken by each call
> depends on the available memory.
> Is there something with the garbage collector or anything else that could
> slow down my function ? Anyone got an idea about it ?
>
> Thank you for your help!
>
> JL
>
> PS : the program takes up to 6.5 MB, the 256 function calls increase the
> taken memory from about 3.5 MB to 6 MB.
> PPS : the indexes of the calls that take 1 second to complete aren't
> always the same, but the more the function have already been called, the
> more a 1 second loop occurs...
>



Re: fonction execution time from 0 to 1s!!! by JL

JL
Mon May 22 02:48:47 CDT 2006

Thank you for your answer, I suppose you're right about something wrong with
my memory management.
It's very hard to show you the whole code, it's a bit long. The problem is
that I need to convert some old C/C++ code to C#/.Net, and that conversion
may be a bit unoptimized! I'll have to check that. I'll follow your advice
and read things about memory management in the CF.

JL

"<ctacke/>" <ctacke[@]opennetcf[dot]com> a écrit dans le message de news:
%237pGszAfGHA.3364@TK2MSFTNGP05.phx.gbl...
> Well since you didn't actually show us the code, it's pure speculation,
> but my bet is that you're doing something poorly with memory management.
> The long runs likely are when the GC has to do a full collection and
> possibly a compaction. Understanding how memory management in the CF
> actually works would go a long way toward you understanding the situation.
>
> -Chris
>
>
> "JL" <jlgarbage@wanadoo.fr> wrote in message
> news:en6QZy0eGHA.2076@TK2MSFTNGP04.phx.gbl...
>> Hi all!
>>
>> I experiment a very strange behaviour with one of my CF2 function.
>> In my program a function is called 256 times in a "for" loop. This
>> function fills some arrays and compute binary paths.
>> I noticed that the whole loop was very slow, so I checked the execution
>> time of each function call. The result is wierd : sometimes the function
>> takes a few milliseconds to complete, and sometimes it takes up to 1
>> second!
>> I first reduced the whole execution time by reducing the amount of memory
>> taken. This way I gained almost 30s! But the whole loop (256 function
>> calls) is still taking 10+ seconds to complete... (the same eVC4/c++
>> computing on a WM2003 PDA takes 4 seconds to complete)
>> I noticed that with the first version of the program, with no
>> optimization of the memory, the number of loops that took 1 second was
>> around 40 times. When I reduced the memory taken by the program, the
>> number of 1 second loops was around 10. So it seems obvious that the time
>> taken by each call depends on the available memory.
>> Is there something with the garbage collector or anything else that could
>> slow down my function ? Anyone got an idea about it ?
>>
>> Thank you for your help!
>>
>> JL
>>
>> PS : the program takes up to 6.5 MB, the 256 function calls increase the
>> taken memory from about 3.5 MB to 6 MB.
>> PPS : the indexes of the calls that take 1 second to complete aren't
>> always the same, but the more the function have already been called, the
>> more a 1 second loop occurs...
>>
>
>