PDA

View Full Version : add_*_head vs add_*


Thaellin
20th August 2003, 01:19 PM
Another 'why' question, here...

Given the performance benefits of add_*_head, why would one use the non-head variants? What do they do differently, and why?

I'm referring to the vertex and surface routines in particular, here, not the vanilla linked-list manipulators.

-- Jeff

Andy
20th August 2003, 05:38 PM
Head adds a new item to the start of a list (very fast) and ordinary add versions append to the end - which means that the end must be found first (potentially quite slow).

Internally, the order of some lists is important e.g. vertices in a surface. children lists.

You should use the _head versions of the list functions if the order is not important (or you want to perhaps reverse a list).

Generally, try not to manipulate the geometry list structures directly but use the functions instead e.g. object_remove_vertex.

Andy