[Scummvm-devel] MADE engine performance

Max Horn max at quendi.de
Wed Sep 23 11:56:13 CEST 2009


Am 23.09.2009 um 10:54 schrieb John Doe:

> Hi,
>
> The problem is that in MADE the mainloop is in the script and so the  
> script interpreter runs all the time in contrast to other games  
> where game scripts are called from the C++ code and run for only a  
> short time.
>
> There's a workaround in script.cpp ("We sleep a little after 500  
> opcodes to reduce the CPU load.") which I added which reduces the  
> CPU load in x86/WinXP considerably. Maybe decreasing this number  
> could help so it will sleep after e.g. 100 opcodes.
>
> I didn't profile it but I guess the engine spends some time in the  
> findObjectProperty in database.cpp since it seems to be called quite  
> often. Theoretically the call result could be cached somewhere  
> (using the call parameters as ID) and reused later on. (I'll try to  
> try that later.)

Well, that should be rather easy to achieve using a Common::HashMap,  
one for each object (i.e. a new member of class Object), with int16  
propertyId as key. Drawback would be increased memory consumption --  
would be good to hear how much "room" is left free on the DS with  
MADE... But then I guess I am telling you things you already know... :)

BTW: I noticed that GameDatabase::getObject() may return NULL, but you  
never check for that. In fact it seems every place calling it assumes  
that it will always return a valid value. Hence shouldn't  
GameDatabase::getObject() not return NULL, but instead assert/error  
when an invalid index is passed in?

Bye,
Max




More information about the Scummvm-devel mailing list