Another thing I read in Improving Execution Speed of Models Implemented in
NetLogo <http://jasss.soc.surrey.ac.uk/20/1/3.html> was when they used
tables instead of 'with' they got a great speed up.

My question is what is wrong with using lists instead. They are constant
time lookup and in this case the table is read-only. I assume the
cell-numbers are just like an array index. As
http://ccl.northwestern.edu/netlogo/docs/table.html says

In general, anything you can do with an table in NetLogo, you could also
just use a list for. But you may want to consider using an table instead
for speed reasons. Lists and tables have different performance
characteristics, so you may be able to make your model run faster by
selecting the appropriate data structure.

Tables are useful when you need to do associate values with other values.
For example, you might make a table of words and their definitions. Then
you can look up the definition of any word. Here, the words are the "keys".
You can easily retrieve the value for any key in the table, but not vice
versa.
While I didn't benchmark this I would expect lists to be faster than tables
in this special case.

-- 
You received this message because you are subscribed to the Google Groups 
"netlogo-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to