Bullet SweepAndPrune optimization (split posting)

Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

I am looking through the Bullet code and try to understand some of the ideas:

Q1: What is actually the motivation for the quantization? What do you win by this? Why do you speak of expanding/shrinking in this context?

Q2: What is the advantage of using continuous arrays instead of a likend list. Again you have to swap (copy) quite a lot of memory when inserting/updating the edge list.

Q3: Is the quantization related to the implementation as array or are these two independent optimizations?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Dirk Gregorius wrote:I am looking through the Bullet code and try to understand some of the ideas:

Q1: What is actually the motivation for the quantization? What do you win by this? Why do you speak of expanding/shrinking in this context?
Reduce memory cost (and improve performance), and perform integer comparison instead of floating point.
Dirk Gregorius wrote: Q2: What is the advantage of using continuous arrays instead of a likend list. Again you have to swap (copy) quite a lot of memory when inserting/updating the edge list.
Arrays are almost always better then linked list nowadays. Traversing linked-lists trashes the cache. Those 3 array are pre-allocated once, and the swapping of endpoint is hence very cache friendly (likely to be in L1 or L2 cache). In case of streaming worlds, with large amount of added new objects the strategy still works, but needs some refinement (I'll discuss this after it is implemented in Bullet).
Dirk Gregorius wrote: Q3: Is the quantization related to the implementation as array or are these two independent optimizations?
Independent. However, note that the overlap check is optimized because of array properties: array indices are compared, instead of the actual min/max values.

Hope this helps,
Erwin