Re: [CODE] [IDEA] Binary Object/Room files

From: George (greerga@CIRCLEMUD.ORG)
Date: 10/24/98


On Sat, 24 Oct 1998, Cervo wrote:

>Ascii Pfiles aren't the greatest things in the world.  Especially if you
>have a ready to go converter.

Do you know how long Jeremy has wanted to make cleanups to structs.h but
couldn't because of binary pfiles?  And the converter argument doesn't work
for us because we can't convert your pfiles for you.  We could modify the
converter accordingly but if you didn't run it, you'd still be out of luck.
I need to change the object files so that autoeq would work properly, again
I can't.  The maximum password length would be much nicer at 20 because we
wouldn't need the configure check for 10 characters.  But we can't.

>Ascii pfiles are probably more popular because most newbies don't know how
>to access binary files.  The advantages to a binary pfile are numberous,
>including speed. Think about it.  Every time somebody stats a file, does a
>last, sets a file, and many other features the entire file has to be
>loaded.

a) Read Sammy's patch, everyone has their own file.
b) Even if it was one file, that would cause it to the cached more often.
   (akin to how your binary pfile will probably always be cached)
c) If you wanted one file, make the playertable include file offsets and
   then you can just fseek() to where you want.

>Binary pfiles are very useful for certain features that go scouting
>through the files.  Say you are interested in how many players are a
>certain class, cycling through the pfile and reading in players is much
>faster in a binary file than it would be to find the filename, load the
>file, and parse the input from an ascii file.

grep 'Class: Wa' pfiles/?/*.pfile | wc

or even better:

grep 'Class:' pfiles/?/*.pfile | cut -d ':' -f 2 | uniq -c

(Hint: It will list how many of each class everyone in the MUD is.)

If you're lazy, you can use popen() under Unix to have these visible from
the MUD side.  Otherwise yes, you would have to parse everything.  Not a
large loss considering even in an SQL database a full data search isn't
exactly speedy. (5 seconds for mySQL to scan/update 200 records on a
P233MMX.)

--
George Greer, greerga@circlemud.org | Genius may have its limitations, but
http://mouse.van.ml.org/   (mostly) | stupidity is not thus handicapped.
http://www.van.ml.org/CircleMUD/    |                  -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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/15/00 PST