Re: Introduction Code, of One Sort or Another

From: Erwin S. Andreasen (erwin@PIP.DKNET.DK)
Date: 11/11/97


On Tue, 11 Nov 1997, StormeRider wrote:

> Alternatively am thinking of some sort of an array that would basically be
> on/off for the player, but thinking while that would be fast it would be
> horribly memory inefficient.
>
> Hrmns. Any followups on this thread would be appreciated, just remember
> that you'd want to run a LOT of intros through and then have a lot of
> people all in the same room.

We (http://www.abandoned.org) use a simple array (reallocated when a
character meets a new person). Each element in the array contains the
32-bit ID of the character that this character knows. Using a linked list
is a waste of memory in this case (overhead of memory manager + next
pointer is at least 8 bytes per introduction, plus running through the
linked list takes much longer than an array).

The first high-level person I checked that was on knows 389 people (
3,444,410 seconds playing time).

The array isn't even sorted. It's a sequential comparison.

Current CPU usage is 2% of this Ultrasparc machine (we do BTW, take up
29mb of RAM, have 20-some thousand rooms, and have executed 8 million
lines of mobprog code in the last 2 days of uptime, so there are plenty
other things the MUD does that take up its time :) ).

It's been a while since I've done any profiling, but I don't think the
function responsible for checking if A knows B ever took more than 0.1% of
the mud's CPU time (i.e. 1/1000 of the 2%). I am pretty sure since I've
spent plenty of time optimizing other functions, but sorting this array
was never worthwhile since the function never showed up in the first 100
functions that used CPU time.

Max players this reboot was 48.


 =============================================================================
Erwin Andreasen   Herlev, Denmark <erwin@pip.dknet.dk>  UNIX System Programmer
<URL:http://pip.dknet.dk/~erwin/>         <*>           (not speaking for) DDE
 =============================================================================


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST