>>>>> "Jim" == Jim Lyons <
jimlyons@...> writes:
Jim> I need what amounts to an associative array. As it happens, both
Jim> the key and value are short fixed length strings. My need is for
Jim> something that will perform well with roughly 2000 entries. About
Jim> 10 to 20 agents will have their own lists and will be using them
Jim> constantly.
I agree with James' answer. If it's annoying to have to juggle two
variables instead of one, you could put both lists inside a single list,
at only a very small cost to efficiency:
[ [k1 k2 ...] [v1 v2 ...] ]
I assume you are primarily concerned with efficiency of lookup rather
than efficiency of update? If you need to be constantly updating the
entries, I'm not sure any solution will be fast unless you write some
Java code using the extensions API.
Jim> It also happens that the strings are all digits. Would it be
Jim> better to convert them to numbers and store and retrieve them that
Jim> way? I would have to convert them back to strings (or digits) for
Jim> use. Do all numbers, even small integers, take up 8 bytes each? If
Jim> so, it seems strings would be the way to go.
I would expect the strings to be both more compact and faster.
--
Seth Tisue /
seth@... / (847) 467-2814
lead developer, NetLogo
http://ccl.northwestern.edu/netlogo/
Center for Connected Learning and Computer-Based Modeling
School of Education and Social Policy / Department of Computer Science
Northwestern University