POV-Ray : Newsgroups : povray.off-topic : Speed comparison between C# and C++ : Re: Speed comparison between C# and C++ Server Time
4 Nov 2024 13:14:26 EST (-0500)
  Re: Speed comparison between C# and C++  
From: scott
Date: 17 Apr 2008 11:32:02
Message: <48076d72$1@news.povray.org>
>> Particles  FPS   CPU %
>>   0       60    00
>> 200       60    00
>> 300       60    01
>> 320       30    05
>
> That's REALLY strange, on my PC the CPU % goes up to 50 (ie, one entire 
> core)!

But what is the CPU % when your frame rate first drops to 30 from 60?  If 
it's under 50% then that means the program is GPU bound.  It will of course 
depend on the relative performance of the CPU and GPU in your machine.  It 
might be that I have a lame GPU compared to my CPU, so you may never see it 
like this on your machine.

Mine goes up to 50% too soon after anyway:

380   30  25
480   10  40
515    3  48
520    1  50

But then using your algorithm of collision detection I would expect the code 
to become CPU bound around this point anyway.

>> What I would add to your program to debug further:
>>
>> a) Add an option to disable rendering each frame (ie just do the physics)
>
> Huh, I even tried that on my machine, and it didn't change anything, so I 
> didn't think it was the graphics... but, I'll try using OpenGL directly, 
> rather than the ClanLib sprite API.

I think the problem is that initially the program is becoming GPU bound 
(which it totally shouldn't for such a simple display), but then because the 
graphics are O(n) and your collision algorithm is O(n^2), at some point the 
program becomes CPU bound.

Improving your collision detection algorithm would help a lot, but then 
still you need to do something with the graphics.  Anyway, best to work on 
one at a time, and disable the other while you do so you can see the true 
performance of each part.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.