[ scummvm-Patches-682981 ] CMI: Experimental language.tab optimization

SourceForge.net noreply at sourceforge.net
Sat Feb 8 18:18:58 CET 2003


Patches item #682981, was opened at 2003-02-08 18:18
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=682981&group_id=37116

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Torbjörn Andersson (eriktorbjorn)
Assigned to: Nobody/Anonymous (nobody)
Summary: CMI: Experimental language.tab optimization

Initial Comment:
This is an experimental patch to speed of the
language.tab handling for CMI. Instead of keeping the
whole language.tab file in memory and do a linear
search every time a text has to be translated, I build
an index (a sorted array) of it and use binary search
to look up the offset.

At first I had planned to use a balanced tree, but I
abandoned that idea when I realized it would easily
double the size of the index. Since it's already 118 KB
I don't want to do that. Besides, qsort() and bsearch()
are almost certainly both less error-prone and better
optimized than anything I could come up with.

I guess it shouldn't be too hard to extend this
mechanism to also cover The Dig, but I don't have any
way to test that.

The difference is particularly noticeable when the game
is displaying a conversation menu. The CPU usage still
rises alarmingly, leading me to believe that there are
further optimizations to do there.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=682981&group_id=37116




More information about the Scummvm-tracker mailing list