Collision module and performance

Community Forums/Monkey2 Talk/Collision module and performance

peterigz(Posted 2016) [#1]
Trying to post this on the other forum but it's not working so will just post to here for now...

I've done an initial convert of my collision code from Blitzmax/Monkey and generally it was all very easy :)

All code available here: https://github.com/peterigz/timelinefx.monkey2 (clone to timelinefx in modules folder)

There are performance issues though so I'd like to tackle that next. It's pretty much the same implementation from Blitzmax/Monkey, I haven't compared with monkey yet, only Blitzmax. I have a simple test with 10000 objects in a quadtree, with a small square that you move around with the mouse to query the quadtree and only draw the objects around the mouse pointer, or you can press space to draw all 10000 objects. So in release with monkey 2:

Drawing mouse objects only: 4-8ms
Drawing all: 80-85ms

Blitzmax
Drawing mouse objects only: 0-1ms
Drawing all: 7-10ms

So at the moment quite a big difference, not sure if that's because I've messed something up in the conversion or there's still some optimising to be done with the compiler.

I do need to check a few things as I had some trouble with the "Concurrent list modification" error; I changed how things work a bit (and I changed to using stacks while I was at it instead of lists), so I may well have messed things up a bit but nothing obvious so far.

Feel free to play with the code, there's a samples folder with the examples in there.


marksibly(Posted 2016) [#2]
Can you send me the bmx version?

The monkey version is timing all the rendering - and the renderer is still a little slower than bmx's - but that seems very quick for rendering on bmx! I tried a little draw random lines demo and it was a lot slower than 10ms in bmx.


peterigz(Posted 2016) [#3]
Hi Mark, the Blitzmax module can be got here: https://github.com/peterigz/rigz.mod

An exe of the file for convenience here: http://www.rigzsoft.co.uk/files/tlQuadTree.exe (note it was compiled with blitzmax ng)

And the actual example code used (slighly modified from the one in the module docs folder):



Yes realise I included all the rendering too but thought it'd worth a comparison anyway, but if I comment out all the drawing code it's still 13-15ms for the whole screen processing vs 2-3 in max. There's every chance it's my implementation of course, so I'll do some more testing when I get a chance.