On Tue, 12 Sep 2006, Kyle Klipowicz wrote:
What I don't understand is why there is a completely different atom, pointer, to index the datastructures. Why not just use an integer? Is it faster?
This is because Miller is still using linked-lists for a bunch of things in Pd. Getting to element number N in a linked-list takes N steps, if you don't have a pointer that gives you direct access. So, yes, it's faster.
I won't advocate switching to integers and B-trees or something, because there's also an advantage to using pointers: if you delete or insert elements in a list, all integers pointing to a later part of the list will get shifted to different elements; with pointers it's not the case.
(a B-tree is one kind of array-like structure in which inserting and deleting is a lot faster than in regular arrays. it's made using several levels of nested arrays. This is not the same as a binary-tree, which also can be used as a fast-inserting array, but which is slower than a B-tree)
(Pd could be reimplemented with a variant on the integer system in which integers wouldn't indicate the order of the objects, but i don't think that it's really worth it.)
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada