Why is my C # calculation time not deterministic?

I run a search algorithm, which is first served with a single seed. From now on, I expect the algorithm to behave in a deterministic way, which pretty much does. I can pretty much verify this by looking at the 10,000th step, the 20,000 steps and seeing that they are identical. What I see differently is the length of time of the thread processor used to get to the same place (taking the same paths). I am measuring thread time using ProcessThread.TotalProcessorTime.

To quantify this, I did some tests for you. I changed the runtime and measured the number of solutions evaluated over that time.


    30s         60s          120s        120s
473,962     948,800     1,890,668   1,961,532
477,287     954,335     1,888,955   1,936,974
473,441     953,049     1,895,727   1,960,875
475,606     953,576     1,905,271   1,941,511
473,283     951,390     1,946,729   1,949,231
474,846     954,307     1,840,893   1,939,160
475,052     952,949     1,848,938   1,934,243
476,797     957,179     1,945,426   1,951,542

475,034     476,599       473,831     486,721
  1,478       2,426        23,922      11,108

8 . , 30 , . 120-, .

, ? ?

:

  • Thread,
  • - Windows XP.Net #
  • , , , .

+5
5

, (GC, , ..) Just in Time.

+5

, . JITing GC . , .

+4

, :

  • , , .
  • , .
  • ​​ , .

, . Windows CE , - , .NET.

, "" : " 20 , . , , .

, "", : " , X, ". , .

+2

CPU time is a shared time, so any other action that occurs on your computer can affect performance. C>

I am correcting myself.

+1
source

What resources does your algorithm use? Is there another process that uses the same resources? This includes CPU, memory, IO (swap file). Other processes will affect the performance of your algorithm.

What is the time difference? 1%? 10%?

+1
source

All Articles