Re: [AD] Font loadin: Feature Request |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Thu, Nov 29, 2001 at 10:13:28AM -0000, Vincent Penquerc'h wrote:
> I would like to offer another point of view on this point.
> In my case, I have a game level that uses a set of graphics, sounds,
> and so on. These are stored in datafiles, and loading the whole thing
> would take a given amount of space.
I didn't say loading the whole was a must (how would diablo work if you
needed 500Mb ram?), only that keeping less files is more efficient for
IO than several thousand 1Kb files in a single directory.
At work I had to write a mini-datafile like format, which basically is a
header plus all the files contatenated. Since this was a custom format,
all the header is kept in memory and all search operations work without
IO. According to tests, simple file_exists calls (which we perform to
support various file formats: .tga, .dds, bmp) where ten thousand faster
than letting the OS do the work, even with lots of ram free to let the
cache help.
File transfer times were reduced by a factor of two to three with small
files. I don't know how this happens, but the tests showed that Windows
is horribly slow finding and loading tiny files, while doing a seek
inside a big chunk is fast.
> it would probably be a bit faster if I did. I load only what I need,
> as this saves a great deal of memory. Sure, you'll tell me that it's
> OK to chew 10 megs more than I do need, but it's an argument I don't buy.
Well, there's a todo for datafile caching systems. I guess this would
provide similar benefits for load_datafile_object as what I experienced
with that custom file format, so you could have a single big file,
loading only neccesary parts.
> Storing the data in different files can bring more ease, but it is
> often not an option, as it would mean either duplicating lots of
> resources or splitting more and more, up to the point where you get to
> datafiles holding a single item.
Well, the last time I used Allegro I created a .dat for each level,
which in the end had to be loaded all the time through the level. You
obviously don't have to reach the extremes with all the ideas :)
--
Grzegorz Adam Hankiewicz gradha@xxxxxxxxxx http://gradha.infierno.org/