[sldev] Texture caching

Dzonatas dzonatas at dzonux.net
Tue Mar 20 15:39:52 PDT 2007

Jason Giglio wrote:
> I realized that too, but the code is on a rare path, better be clear 
> about it than put in some premature optimization.  Lots of discussion 
> over a one-line nonfunctional change. :P

If mTexturesDirEntriesFileName references a file, and that file is being 
used by the single instance of the client, the filesize could be cached. 
There would be no need to actually go out to the filesystem to check the 
filesize after it has been read the first time.

Just read the cached filesize value. If bytes_read != filesize, then 
show the error.   Very simple :

U32 LLTextureCache::TexturesDirEntriesFileSize( void )
if( mTexturesDirEntriesFileSize != -1 && ! multiple-instances )         
   // NOTE: class variable mTextureDirEntriesFileSize is initialized to -1
    return mTexturesDirEntriesFileSize ;

return ll_apr_file_size(mTexturesDirEntriesFileName, NULL) ;

It would save some system calls.

More information about the SLDev mailing list