ASCII pfiles and speed

From: Ben Cartwright (
Date: 02/03/00

    Using ASCII pfiles instead of binary adds a great deal of flexibility as
far as adding new stuff goes, so I decided to add them to the mud I'm
working on.  However, it takes the mud a lot longer to get through the
save_char function, as it's doing a lot more work than before.
    Such are the consequences of having a variable-length player entry.  I
did go through the save_char function and changed all the fprintf's to
sprintf(buf + strlen(buf), ...)'s, and a single fwrite at the end.  I also
attempted to optimize it by combining all the sprintf's that I could.  In
the end I made save_char about twice as fast as it before (btw, I'm using a
heavily modified version of Samedi's ASCII pfile system) , but the speed is
still noticably slower than a port of the mud running on the same server
with binary pfiles.

    Commands that call save_char repeatedly... such as the immortal
'advance' command, and some clan commands that need to update all members
(such as inserting new ranks) cause a very noticable pause in the game while
save_char rushes to write everything out.  Players spamming 'quit;1' can
also slow the mud down too.  A significant number of players getting
together and spamming that for a while can cause a lot of missed pulses,
even on a mud that uses binary pfiles.
    Anyway, the purpose of this message to ask any mud admins who use ASCII
pfiles in their mud (with players of course:P) whether speed has been that
big of a pain, and any pointers on further optimizing the speed.

    I'm considering making some sort of queque for chars that need saving,
so it can be done gradually, and the mud won't be calling save_char for the
same character repeatedly. (such as in the 'advance' command)  But before I
make that my project for the first half of the weekend, I thought it would
be worthwhile to ask someone who's been using ASCII pfiles in their
production mud, in case there's another solution I've been overlooking.

    --Ben Cartwright

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT