#Quadtree is slow.

7 messages · Page 1 of 1 (latest)

rugged coral
#

Ok i implemented quadtree using wikipedia's pseudo code and coding train's video

Goal was to check for collision for 5000 particles but it's running 22fps after implementing quad tree.

Here are my files
https://github.com/Developer-Harshit/QuadTree-Example

I doubt I did some silly mistake in QuadTree. pde which is causing it to run slow

GitHub

Contribute to Developer-Harshit/QuadTree-Example development by creating an account on GitHub.

flint frigate
#

I tinkered with the sketch a little bit, and couldn't pinpoint a single place that drastically impacted performance. A couple ideas though: there canvas looks more or less equally dense, so the quadtree resembles just a plain grid. Also, the quadtree needs to jump through the Node to get to the particle, while collision check without quadtree just looks at a single array with particles, which is good for the cpu cache. quadtree with a cap of 2 spams a lot of sub arraylists which have to be garbage collected every frame. Number of comparisons for plain loop check (10 mil) is much more than through the quadtree (depends on cap) but quadtree instanciation each frame and querying are so much more expensive

crystal fox
#

Have you tried to increase the RAM in the settings?

rugged coral
rugged coral
crystal fox
rugged coral
#

If you are talking about Increase the maximum available memory option, then no it doesn't get faster by increasing it