MOO-cows Mailing List Archive

[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: my kingdom for a hash table!

Amy Bruckman wrote:
> > 	object.(propname)
> > is almost exactly the same as:
> > 	values[propname in keys]
> When I was first starting all of this coding, Pavel warned me off of creating
> any long lists.  He mumbled something about operations increasing exponential
> to the length of the list, and looked embarassed.

Defining a new property on an object is almost exactly the same (inside
the server) as:

	properties = {@properties, {name, owner, flags}};
	values = {@values, [clear]};

Except that the second step happens for *every descendent* of an object.
As Jay points out, currently the only advantage to the linear lookups
done on the list of properties is that it uses a simple hash to avoid
a strcasecmp for things that can't possibly be equal.  On the other
hand, that's probably offset by the fact that failed property lookups
go up the parent chain looking for a successful match.

I don't buy Jay's argument that you should use properties instead of
lists because we are more likely to optimize property lookup before list
operations.  Also, if you're going to plan your design around future
server enhancements, why not plan for having a dictionary type?

> (I imagine the speedy rogue server fixes this?)

Most of the pitfalls of using long lists were fixed some time ago, though
the rogue server does speed up some operations very basic to list
maintenance and makes some common end cases go faster (mostly associated
with building lists as arguments to functions or verbs).


Home | Subject Index | Thread Index