<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
Hi!<BR>I have just compiled a trunk version of ScummVM with sword1&2 engines built in. I compared this result with a binariy I built 20080907.<BR>
Old code size:<BR>
0x1797f4(1546228) bytes<BR>
Old static data size:<BR>
0x2ec0(11968) bytes<BR>
 <BR>
New code size:<BR>0x19f060(1699936) (difference 153708 bytes)<BR>
 <BR>
New static data size:<BR>
0x2ef0 (12016) (difference 48 bytes)<BR>
 <BR>
I would n't say that an addition of 150Kb is alot for Symbian OS, but I guess it might be an issue for Nintendo DS.<BR>
 <BR>
Cheers<BR>
Lars<BR>> From: max@quendi.de<BR>> To: scummvm-devel@lists.sourceforge.net<BR>> Date: Thu, 16 Oct 2008 19:28:17 +0200<BR>> Subject: [Scummvm-devel] Code size<BR>> <BR>> Hi folks<BR>> <BR>> we recently talked about the size of a scummvm executable and how it <BR>> grew with the merger of the GUI branch. I guess that is partially due <BR>> to the fact that we now have an XML parser, too... ;) But I figured it <BR>> might be helpful to generate some more data to figure out where we <BR>> might be able to gain the most.<BR>> <BR>> What I did was to compile a "release" binary for both trunk and the <BR>> 0.12.0 branch. So I run<BR>> configure --enable-Werror --enable-release [ lots of --enable- <BR>> ENGINE statements ]<BR>> and made fresh builds for both, on an Apple MacBook Pro, with Apple's <BR>> modified GCC 4.0.1. Our "--enable-release" switch ensures that -O2 is <BR>> passed to the compiler.<BR>> <BR>> I then sorted all *.o files by size of their TEXT segment. Since <BR>> engine code and infrastructure are kind of separate, I did this <BR>> separately independently on both. (I took the liberty of re-inserting <BR>> the column headers below for readability)<BR>> <BR>> TRUNK rev 34812, non-engine code:<BR>> <BR>> $ size */*.a | sort -nr | head<BR>> __TEXT __DATA __OBJC others dec hex<BR>> 87543 1180 0 0 88723 15a93 graphics/libgraphics.a(hq3x_i386.o)<BR>> 65445 1204 0 0 66649 10459 graphics/libgraphics.a(hq2x_i386.o)<BR>> 65016 1072 0 566 66654 1045e gui/libgui.a(ThemeEngine.o)<BR>> 54833 144 0 607 55584 d920 gui/libgui.a(ThemeParser.o)<BR>> 46803 552 0 844 48199 bc47 gui/libgui.a(launcher.o)<BR>> 46585 424 0 71 47080 b7e8 graphics/libgraphics.a(VectorRendererSpec.o)<BR>> 39371 36 0 364 39771 9b5b base/libbase.a(commandLine.o)<BR>> 32745 308 0 405 33458 82b2 gui/libgui.a(options.o)<BR>> 28307 1700 0 354 30361 7699 sound/libsound.a(audiostream.o)<BR>> 22409 140 0 536 23085 5a2d common/libcommon.a(advancedDetector.o)<BR>> <BR>> $ ll -S */*.a<BR>> -rw-r--r-- 1 mhorn staff 736892 16. Okt 18:56 gui/libgui.a<BR>> -rw-r--r-- 1 mhorn staff 607148 16. Okt 18:56 graphics/libgraphics.a<BR>> -rw-r--r-- 1 mhorn staff 419884 16. Okt 18:56 sound/libsound.a<BR>> -rw-r--r-- 1 mhorn staff 365740 16. Okt 18:56 common/libcommon.a<BR>> -rw-r--r-- 1 mhorn staff 133636 16. Okt 18:56 backends/libbackends.a<BR>> -rw-r--r-- 1 mhorn staff 110956 16. Okt 18:56 base/libbase.a<BR>> -rw-r--r-- 1 mhorn staff 45876 16. Okt 18:56 engines/libengines.a<BR>> <BR>> <BR>> 0.12.x BRANCH , non-engine code:<BR>> <BR>> $ size */*.a | sort -nr | head<BR>> __TEXT __DATA __OBJC others dec hex<BR>> 87543 1180 0 0 88723 15a93 graphics/libgraphics.a(hq3x_i386.o)<BR>> 65445 1204 0 0 66649 10459 graphics/libgraphics.a(hq2x_i386.o)<BR>> 51949 160 0 370 52479 ccff gui/libgui.a(ThemeModern.o)<BR>> 38997 36 0 374 39407 99ef base/libbase.a(commandLine.o)<BR>> 32101 424 0 710 33235 81d3 gui/libgui.a(launcher.o)<BR>> 29182 296 0 341 29819 747b gui/libgui.a(options.o)<BR>> 28307 1700 0 354 30361 7699 sound/libsound.a(audiostream.o)<BR>> 27710 84 0 269 28063 6d9f gui/libgui.a(theme-config.o)<BR>> 22040 120 0 462 22622 585e common/libcommon.a(advancedDetector.o)<BR>> 20945 160 0 249 21354 536a gui/libgui.a(ThemeClassic.o)<BR>> <BR>> $ ll -S */*.a<BR>> -rw-r--r-- 1 mhorn staff 594716 16. Okt 19:16 gui/libgui.a<BR>> -rw-r--r-- 1 mhorn staff 524604 16. Okt 19:16 graphics/libgraphics.a<BR>> -rw-r--r-- 1 mhorn staff 416684 16. Okt 19:16 sound/libsound.a<BR>> -rw-r--r-- 1 mhorn staff 267020 16. Okt 19:16 common/libcommon.a<BR>> -rw-r--r-- 1 mhorn staff 146228 16. Okt 19:16 backends/libbackends.a<BR>> -rw-r--r-- 1 mhorn staff 118244 16. Okt 19:16 base/libbase.a<BR>> -rw-r--r-- 1 mhorn staff 8608 16. Okt 19:16 engines/libengines.a<BR>> <BR>> <BR>> So, the HQx scalers are big, but they are desktop-only, so no problem. <BR>> But then, a very sizable chunk is taken by the new GUI code. The old <BR>> code was not tiny either, but it's clear that libgui.a and <BR>> libgraphis.a grew considerably (also libcommon.a grew, partially due <BR>> to the XML parser, but other changes are in there as well). It sure <BR>> would be nice to get those number back down a bit...<BR>> <BR>> However, take all these numbers with a big grain of salt: We use lots <BR>> of template code these days, and that causes the compiler to generate <BR>> certain chunks of code multiple times, put into each *.o file <BR>> separately. Only during linking time are these duplicates resolved and <BR>> removed. So, the actual contribution of those *.o files to the <BR>> resulting binary might be a lot less than what is listed above.<BR>> <BR>> On the other hand, this immediately hints at a potential way to save <BR>> memory: By carefully reconsidering how we use templates; esp. for the <BR>> container classes, we might be able to save some KB of duplicate code <BR>> (duplicate because the compiler generates it anew for each e.g. <BR>> HashMap variant, even though the code each time is almost or <BR>> completely identical). There are some ways to reduce that. If anybody <BR>> is interested in looking into that, talk to me.<BR>> <BR>> <BR>> Here's what I got for engines (I enabled all engines):<BR>> <BR>> TRUNK rev 34812, non-engine code:<BR>> <BR>> $ size engines/*/*.a | sort -nr | head<BR>> __TEXT __DATA __OBJC others dec hex<BR>> 98802 2924 0 546 102272 18f80 engines/kyra/libkyra.a(staticres.o)<BR>> 77058 64 0 553 77675 12f6b engines/lure/liblure.a(hotspots.o)<BR>> 55721 244 0 351 56316 dbfc engines/touche/libtouche.a(touche.o)<BR>> 54580 2112 0 333 57025 dec1 engines/kyra/libkyra.a(sound_towns.o)<BR>> 53776 29904 0 613 84293 14945 engines/scumm/libscumm.a(detection.o)<BR>> 51834 48 0 532 52414 ccbe engines/kyra/libkyra.a(script_lok.o)<BR>> 51821 44 0 346 52211 cbf3 engines/igor/libigor.a(igor.o)<BR>> 51025 96 0 719 51840 ca80 engines/kyra/libkyra.a(script_hof.o)<BR>> 50265 0 0 320 50585 c599 engines/drascula/libdrascula.a(animation.o)<BR>> 48901 256 0 509 49666 c202 engines/drascula/libdrascula.a(rooms.o)<BR>> <BR>> To put this into perspective, here's the size of the lib*.a files for <BR>> each engine (to be taken with even more grains of salt, of course, but <BR>> they give a good rough indication anyway):<BR>> $ ll -S engines/*/*.a<BR>> -rw-r--r-- 1 mhorn staff 2661204 16. Okt 18:51 engines/scumm/libscumm.a<BR>> -rw-r--r-- 1 mhorn staff 1960012 16. Okt 18:53 engines/kyra/libkyra.a<BR>> -rw-r--r-- 1 mhorn staff 1027996 16. Okt 18:52 engines/gob/libgob.a<BR>> -rw-r--r-- 1 mhorn staff 877820 16. Okt 18:54 engines/parallaction/ <BR>> libparallaction.a<BR>> -rw-r--r-- 1 mhorn staff 823140 16. Okt 18:51 engines/agos/libagos.a<BR>> -rw-r--r-- 1 mhorn staff 740188 16. Okt 18:55 engines/saga/libsaga.a<BR>> <BR>> [...]<BR>> -rw-r--r-- 1 mhorn staff 238412 16. Okt 18:54 engines/made/libmade.a<BR>> <BR>> 0.12.x BRANCH , non-engine code:<BR>> <BR>> $ size engines/*/*.a | sort -nr | head<BR>> 92384 3040 0 531 95955 176d3 engines/kyra/libkyra.a(staticres.o)<BR>> 77074 64 0 553 77691 12f7b engines/lure/liblure.a(hotspots.o)<BR>> 57233 0 0 345 57578 e0ea engines/drascula/libdrascula.a(animation.o)<BR>> 55273 236 0 341 55850 da2a engines/touche/libtouche.a(touche.o)<BR>> 54956 2368 0 353 57677 e14d engines/kyra/libkyra.a(sound_towns.o)<BR>> 51882 48 0 532 52462 ccee engines/kyra/libkyra.a(script_lok.o)<BR>> 51854 36 0 346 52236 cc0c engines/igor/libigor.a(igor.o)<BR>> 51487 29832 0 558 81877 13fd5 engines/scumm/libscumm.a(detection.o)<BR>> 50993 96 0 719 51808 ca60 engines/kyra/libkyra.a(script_hof.o)<BR>> 49606 40 0 554 50200 c418 engines/drascula/libdrascula.a(rooms.o)<BR>> <BR>> $ ll -S engines/*/*.a<BR>> -rw-r--r-- 1 mhorn staff 2690660 16. Okt 19:16 engines/scumm/libscumm.a<BR>> -rw-r--r-- 1 mhorn staff 1861188 16. Okt 19:16 engines/kyra/libkyra.a<BR>> -rw-r--r-- 1 mhorn staff 948060 16. Okt 19:16 engines/gob/libgob.a<BR>> -rw-r--r-- 1 mhorn staff 803404 16. Okt 19:16 engines/agos/libagos.a<BR>> -rw-r--r-- 1 mhorn staff 711500 16. Okt 19:16 engines/saga/libsaga.a<BR>> -rw-r--r-- 1 mhorn staff 696756 16. Okt 19:16 engines/parallaction/ <BR>> libparallaction.a<BR>> [...]<BR>> -rw-r--r-- 1 mhorn staff 232492 16. Okt 19:16 engines/made/libmade.a<BR>> <BR>> So it seems most engines got a bit bigger, somehow... This might be <BR>> due to changes to our templated code in common, not sure yet.<BR>> <BR>> Cheers,<BR>> Max<BR>> <BR>> -------------------------------------------------------------------------<BR>> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge<BR>> Build the coolest Linux based applications with Moblin SDK & win great prizes<BR>> Grand prize is a trip for two to an Open Source event anywhere in the world<BR>> http://moblin-contest.org/redirect.php?banner_id=100&url=/<BR>> _______________________________________________<BR>> Scummvm-devel mailing list<BR>> Scummvm-devel@lists.sourceforge.net<BR>> <A href="https://lists.sourceforge.net/lists/listinfo/scummvm-devel">https://lists.sourceforge.net/lists/listinfo/scummvm-devel</A><BR><br /><hr />Discover the new Windows Vista <a href='http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE' target='_new'>Learn more!</a></body>
</html>