Re: ASCII vs. Binary pfiles

From: Daniel A. Koepke (
Date: 04/04/01

On Wed, 4 Apr 2001, Peter Ajamian wrote:

> Anyone want to comment on this one?  ASCII vs. binary pfiles.  I am
> probably in the minority, but I tend to prefer binary because (AFAIK)
> they load in faster and easier (no parsing necessary).

Binary does load faster, but not considerably more so for well-written
parsing code.  And if you're not parsing the binary data in any way, then
you have a fairly inflexible format.  That can make things a pain to work
with when your program is more evolved than designed and implemented, as
is the case with most Muds (and, indeed, hobbiest projects, in general).
You also make it that much more difficult to review your data on disk.
Using ASCII pfiles, you can fairly easily parse it with standard UNIX
shell utilities to collect statistics, notice anomolies, etc.

> Also, there is a space consideration with ASCII which takes up lots
> more room plus wastes more space by storing each player's data in a
> seperate file (thus taking up directory space and wasted space to fill
> to the sector boundry on disk).

It's questionable how much more room (if any) ASCII takes up per record.
Of course, it's dependent on the format of your data (in both cases), but
with a simple, "Field: value," format, the difference is probably
negligible because strings in binary are always padded to their maximum
length (unless you "parse" the binary data, in which case you can store
the string length and then the string -- but that's a tradeoff, since you
can no longer just fread() the whole record at once).

The second issue, about physical disk space use, is less of an issue to
me: if your inode size is that wonky, then you probably shouldn't be
coding on that computer.  After all, what is the typical program's source
code but a set of small, ASCII files?

I think it boils down really to a "how-I-feel" at any given moment and a
per-case review.  Like so many things in modern computer science, the
technological superiority of one approach is no longer as clear-cut.  At
least partly because technological superiority no longer well-defined for


   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/05/01 PST