Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CF: ideas for next experiments



dragonm wrote:

>  There is no good solution to this.  Ideally, better programming may be
> needed - if something is going to search the inventory for 10 different
> objects, it should just traverse the inventory once, and store the 10
> different objects as it finds them.
> ----------------
> If you're going to spank David over memory usage, I get to spank you over
> CPU usage.  Not only do we have memory to burn, we have CPU cycles to burn
> as well.  That under $600 machine that ships with 64 megs of RAM also has a
> 300 MHz Celeron in it.  My machine has TWO Pentium II 300's in it.  If
> memory usage isn't a valid argument for or against a method of doing
> something, neither is CPU usage.

 But note this conversation originally came up because it was noted some areas
of code traverse the players inventory a lot.  If cpu usage is not a concern,
then at that point we don't care if we traverse the inventory a lot or not,
since cpu cycles are cheap.

 Which then goes to follow your comment - don't worry about it for now.  If
constant traversal of the players inventory does appear to be costly (in
profiling or whatever), we can worry about better implementations down the road.

 But the real point is that if this is a concern, the re-implementation to make
it faster can not just burn cpu cycles to do it, since then it really isn't
faster.  So instead, we probably burn some amount of memory.

 Re the binary tree discussion - I am not sure how well that works since the
players inventory constantly changes - more importantly, stuff is actually
removed from the players inventory.  So if you have something like:

 	A
       / \
      B   C
     / \ / \
    D  E F  G

 And A gets removed, you need to do some reshuffling on the binary tree. 
Probably not incredibly costly, but probably more costly than just removing a
link from a tree.

 Also, to do a binary tree, you really need 3 pointers - left, right, above. 
You need the above so that if something is removed, you know what to re-adjust.
-
[you can put yourself on the announcement list only or unsubscribe altogether
by sending an email stating your wishes to crossfire-request@ifi.uio.no]