[Solved] Very slow with only 50 bodies

Hello,
I am creating a cell simulator using box2D. Each object is a circle and has forces applied. My problem is that after 50 cells, the Step function takes more and more time to process. It affects the fps, dropping below 10fps.
Shouldn't it be more like a thousand bodies?
Could the fact that they are circles slow down the whole thing?
Any suggestion?

LH

PS: I'd be glad to provide log or code if it could help.
With questions about performance, it would be good to mention what hardware, platform and rendering framework you're running on, because it makes a big difference to what would be considered 'normal'. How can anybody say whether you should expect 1000 bodies, without knowing what you are running this on...

This might be relevant: viewtopic.php?f=18&t=9535
Hi, Thanks for your answer.

I have a laptop, dell inspiron 1545. Ubuntu 13.10, Box2d 2.3, running on 3,9 Gio RAM, Intel® Core™2 Duo CPU T6500 @ 2.10GHz × 2.
[edit] Oh, and I render this with gcc on Code::Blocks and the code is (really bad) C++;

Here is an example of what I had previously in my simulation: http://etienneblanc.fr/LaOuJEnSuis.png
It seems that my program was way faster a few weeks ago. I now have those performances (2.6 fps) with less than a hundred cells.
I did uprgade yesterday to Box2d 2.3 and it did not change my problem.

This seems to be linked to another problem I have: a major freeze of the prog. This happens irregularly and the debugger says to me that it comes from SolveTOI that becomes extremely slow (many seconds to process). Should I create a new post with this second problem or could it be related?

Thanks irresistibleforce
LH
Okay I did change the b2Settings.h and changed
Code:
#define b2_aabbExtension                0.3f


I did get decent results.

But I still have the freezing problem (SolveTOI takes many (many many) seconds to process). Should I change the post title or create a new post?

Thanks,
LH

PS:
Quote:
#0 0x807839d b2ContactManager::AddPair(void*, void*) () (??:??)
#1 0x8078a8e void b2BroadPhase::UpdatePairs<b2ContactManager>(b2ContactManager*) () (??:??)
#2 0x8078324 b2ContactManager::FindNewContacts() () (??:??)
#3 0x807b4f3 b2World::Solve(b2TimeStep const&) () (??:??)
#4 0x807c547 b2World::Step(float, int, int) () (??:??)
#5 0x807387b updateBox2D() (/home/eeblanc/Workspace/C-Lulz/src/Main.cpp:174)
#6 0x8073b8a loop() (/home/eeblanc/Workspace/C-Lulz/src/Main.cpp:242)
#7 0xb7fb7aa8 glutMainLoop() (/usr/lib/i386-linux-gnu/libglut.so.3:??)
#8 0x807457e main(argc=1, argv=0xbffff704) (/home/eeblanc/Workspace/C-Lulz/src/Main.cpp:427)
I see. Then 1000 bodies is a perfectly reasonable number to expect to still run smoothly.
Are you making the bodies as 'bullet' type bodies? That could slow things down and is probably not necessary.
Just to be sure, it's not the rendering that's slowing things down right?
Hi,
For what I have now, the fps runs around 60 up to about a hundred cells. The graphics are not so slow, opengl deals with the whole thing alright. No, the main cause would be the fact that each body has a sensor attached.

To be honest, I'm not that much concern with the speed of the thing anymore (after changing the Settings). At least not as much as when I wrote this post.

I am more concerned by the random freezing of the program, callstack posted above. 😢
Thanks,
Etienne

PS: Should I write a new post for it?
All right, for anybody who comes around with the same problem:

Be sure to check that the force x and y are different than NaN... The simulation will work way better
(Could be an easy thing to test in Box2D itself, by the way)

Subject close,
Thanks irresistibleforce
Yeah, a NaN and Inf checker would be good.

Original thread: https://box2d.org/forum/viewtopic.php?t=9550