[Scummvm-devel] Kyrandia engine loading is slow on the DS

Neil Millstone neil at millstone.demon.co.uk
Fri Aug 22 10:14:09 CEST 2008

Max Horn wrote:
> Am 20.08.2008 um 23:34 schrieb Bertrand Augereau:
>> Hi Neil, hi team,
>> given your numbers we can approximate the time of a fopen to 15ms.
>> Therefore, on the 65 seconds to launch Kyrandia 1, the 2k fopen 
>> account for 30 sec, and the rest is 35 seconds.
>> Maybe we could maintain a cache of filename to file handles in kyra 
>> resource manager to open files only once, we probably could gain 20 
>> seconds more.
> This will be solved for good by the file handling revamp on which 
> peres and I am working, which besides other things, implements a cache 
> for which files exist and which don't. But it won't make it into the 
> 0.12 release, too many deep changes are involved.
> In the meantime, though, you could of course simply write a more 
> clever fopen implementation. Since the DS provides a custom fopen 
> anyway, a simple cache could be implemented in there. I reckon that 
> would take maybe 50 lines of code to do, and should easily bring down 
> the load times to a few seconds.
> Cheers,
> Max
Hi Max & Team,

I have done a little more digging around this issue, and have found that 
the DS fopen does indeed use a cache, in fact it looks like I increased 
the cache size in the Kyrandia build in 0.11.1 order to help this 
issue.  Unfortunately, even with this, it seems the time taken to load 
the game is not spent in the DS backend.  Without a profiler it's hard 
to say why it's so slow, but the engine does seem to search various 
tables for files before it tries to open them on disk.  Perhaps this is 
just too much for the DS's 66Mhz CPU.  I dare not change the Kyra 
loader, it looks extremely complex to me and I don't really understand 
how it works.

So, for now, this issue will have to be in the release notes, although 
I'm sure I will get complaints about it, since this worked in 0.11.1.

- Neil

More information about the Scummvm-devel mailing list