[sldev] Re: Reformatting Textures for the cache

Dzonatas dzonatas at dzonux.net
Thu Mar 22 12:25:49 PDT 2007


Argent Stonecutter wrote:
> The overhead of a relational database is much much higher than the 
> overhead of plain disk files for bulk data like images, and internal 
> fragmentation is a much bigger problem than disk fragmentation. In 
> fact disk fragmentation has not been a significant problem on most 
> operating systems introduced in the last 20 years. Windows, of course, 
> is the big exception to that rule. :p
The simple Berkely-DB format is not relational. It is just a key index 
into files.

The quick hack for an image database like this is to create a sparse 
memory mapped file and allow malloc() or such to allocate blocks of 
memory for it.  A single memory mapped file would be limited in size 
(like 2 or 4GB), but a few of these files would serve its purpose. 
Having the sparse flag set will allow the OS to determine when to 
clean-up unused portions, and there would be no need to program that as 
a seperate thread.


More information about the SLDev mailing list