Search code examples
lispautocadautolisp

Using Lisp (or AutoLisp) how good is the associative lists performance?


I'm doing an AutoLisp project which uses long associative structures to do heavy geometrical processing - so I'm curious about the associative list intense use timing results. How simple/complex is the implementation? It uses some data structure or a normal list of dotted pairs? The are any extension for b-tree or something?


Solution

  • In Common Lisp and Emacs Lisp association lists are linked lists, so they have linear search time. Assuming that AutoLisp is the same (and if it isn't, then their use of the term "Associative List" is misleading), you can assume that all operations will be linear in the length of the list. For example, an alist with 100 elements will, on average, need 50 accesses to find the thing that you are after.