[Scummvm-devel] Fastening text display in Scumm engine
Nicolas Bonifas
nicolas.bonifas at free.fr
Tue Jun 26 11:40:20 CEST 2007
Hello,
I wrote a small patch that dramatically fastens text display in Scumm,
by simply recording the values returned by unpackChar instead of
computing them each time we need them.
It is only a proof of concept (I lack time to polish it at the moment):
- it needs better integration (I am new to Scummvm development)
- _unpackedChars array is probably useless: we should directly record
the unpacked characters in _chars[].src and use this value whatever the
value of _bpp
- every call to unpackChar needs to be replaced (for example, call from
drawFrame)
- there may be a memory leak (I never free the _unpackedChars array).
Nevertheless, the results are very good. Here are the execution times
for the ending sequence of COMI with and without the patch, in the same
conditions (on a 1.5 Ghz processor). Included is the beginning of gprof
flat profile.
with patch : 31.88 seconds
% time seconds calls name
46.80 14.92 58257 Normal2x(unsigned char const*, unsigned int,
unsigned char*, unsigned int, int, int)
15.18 4.84 1354665
Scumm::NutRenderer::drawChar(Graphics::Surface const&, unsigned char,
int, int, unsigned char)
11.39 3.63 175576 Scumm::blit(unsigned char*, int, unsigned
char const*, int, int, int)
5.66 1.80 58081 OSystem_SDL::copyRectToScreen(unsigned char
const*, int, int, int, int, int)
without patch : 51.81 seconds
% time seconds calls name
37.62 19.49 1354972 Scumm::NutRenderer::unpackChar(unsigned char)
29.99 15.54 58188 Normal2x(unsigned char const*, unsigned int,
unsigned char*, unsigned int, int, int)
9.25 4.79 1354460
Scumm::NutRenderer::drawChar(Graphics::Surface const&, unsigned char,
int, int, unsigned char)
6.62 3.43 175579 Scumm::blit(unsigned char*, int, unsigned
char const*, int, int, int)
3.38 1.75 58075 OSystem_SDL::copyRectToScreen(unsigned char
const*, int, int, int, int, int)
Regards,
Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: scummvm260607.patch.gz
Type: application/gzip
Size: 546 bytes
Desc: not available
URL: <http://lists.scummvm.org/pipermail/scummvm-devel/attachments/20070626/0163a731/attachment.gz>
More information about the Scummvm-devel
mailing list