On Tue, Feb 26, 2002 at 09:00:27PM -0500, Steven Radziul wrote:
> I got a question concerning MAX_KEY_HAS:
> What the heck is it :) and what happens if I increase it

Your mud may work faster. Or slower. Depends how lucky you are.

Anyway, you know about linked-lists? They are way cool for storing
information in them, only searching is a little bit of a problem,
that's always a O(N) cost because you have to go through all the
records in the list.

If there was a search-string for the records in the list which was
easy to work with, for example a unique identifier for each records,
we could insert all the records in the list in the order of the
identifier and keep a seperate list of pointers to records in that
list which are milestones, for example every 100th item. So if
you're looking for item 321, you look in the seperate list where
item ( 321 / 100 ) * 100 = 300 starts and then go searching in that
part of the list until you're at the item you're looking for or at
item 400 and you know it's not there. So you only have to search
through 100 items max, making it a O(100) cost.

But, you now have an unbalanced indexing, many thing might point
to empty records since 1000-2000 might not exist but there are still
pointers to it. So instead of putting a pointer at every 100nth
record, we make a seperate list (array in this case) with pointers
to all records which are modulo 100 (%100). So the first list
contains records 0, 100, 200, 300, the second list 1, 101, 201,
301, the fourth list 2, 102, 202, 302 etc. Even if 1000-2000 doesn't
exist, the 'load' in the lists will still be balanced.

MAX_KEY_HASH defines how much pointers you have in the seperate list.

And now I have to run because I'm invited for a baby-visit :-)

[...oops, deleted this line...]
> it popping up on the bottom of messages anymore. I went through bout 100 of
> them in my box and can't find it.

http://the-infinite.org/lists/romlist/

Edwin

-- 
Edwin Groothuis   |              Personal website: http://www.MavEtJu.org
[EMAIL PROTECTED] |           Interested in MUDs? Visit Fatal Dimensions:
------------------+                       http://www.FatalDimensions.org/

Reply via email to