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

CF: Patch: proposed performance increase



I propose this modification; perhaps as an #ifdef.  It increases
subjective performance at the cost of consuming more memory.  Feedback
welcome.

On slow Linux systems, such as 486/33, with plenty of physical memory,
but slow SCSI disks, Crossfire pauses significantly a short time after a
player enters a new map.  If, after this pause, the player decides to go
back to the previous map, another pause is encountered.  (0.93.4 &
0.93.7)

I traced this to the swap forcing logic, and in my copy of 0.93.4 I
added logic to set a lower limit for the map timeout value.  My patch to
server/main.c is attached.

This wasn't sufficient; the pause still occurred, just later.  Usually
about when the player had met something threatening in the new map.  ;-)

So I modified the logic in server/swap.c to avoid swapping altogether
unless the number of objects exceeds the MAX_OBJECTS value.  If swapping
is commenced, it will continue until the number of objects falls below
half of MAX_OBJECTS.

This causes MAX_OBJECTS to be significant.  If it is set too high, and
causes the process to exceed available physical memory, then the game
starts to slow due to the page faults.

After some time, the system stabilises with most current maps in memory.
Moving between maps tends to be swift, and the only swap-outs are done
when a player moves to a new map.

I would expect that an alternate solution would be to perform the
swap-out slowly rather than instantly.

These patches are relative to 0.93.7.

--
James Cameron                                    (cameron@stl.dec.com)
Digital Equipment Corporation (Australia) Pty. Ltd. A.C.N. 000 446 800


[to unsubscribe etc., send mail to crossfire-request@ifi.uio.no]