[Scummvm-devel] Conditionally compiling components (Was: Clarifying & cleaning configure's cross-compiling craziness)

Max Horn max at quendi.de
Thu May 5 11:38:54 CEST 2011


Am 05.05.2011 um 10:32 schrieb Max Horn:

> 
> Am 04.05.2011 um 17:25 schrieb A. Milburn:
> 
>> On Wed, May 04, 2011 at 05:18:29PM +0200, Max Horn wrote:
>>> The indeo3 code is only enabled if gob is compiled in, or dynamic plugins are enabled. 
>>> 
>>> It seems odd that we do this for indeo3, but not for e.g graphics/png.*, graphics/jpeg.*, graphics/dcl.* etc. Let's either drop the indeo3 check, or add check for more "optional" features.
>> 
>> I asked about this on IRC a few days ago. It seems that the check is there due to
>> https://sourceforge.net/tracker/index.php?func=detail&aid=2836424&group_id=37116&atid=418822
>> which notes that there are 72kb of tables in the decoder, adding considerably to code
>> size if compiled in. Is this a problem for other code?
> 
> qdm2 might be a contender:
> 
> video/codecs/qdm2.cpp seems to contains huge tables. In particular tables with a total of 128k floats, i.e. 512kb. These tables seem to contain precomputed sine / cosine values. One could allocate those on the stack, I guess, but I wonder about them anyway -- at least on desktop pcs, just re-computing the (co)sine might be a lot faster than completely stuffing the CPU cache.
> However, since these are not const and not prepoulated, they should only take size on the heap, not in the binary.
> 
> video/codecs/qdm2data.h contains about 10kb (?) of static const data.
> 
> Interestingly, though, when building in release mode with debug off


I should add, though, that qdm2 decoding is only enabled when the MOHAWK engine is compiled in. Hence, even though the SCI engine uses the QT decoders, it is not affected by the size of the qdm2 code (at least when compiling without dynamic plugins).

For the record, I made some test builds for the NDS port, with "--enable-release --disable-debug"; plugins were not enabled. I made four builds, one each for the MOHAWK, SCI, SCUMM and TUCKER engine: Mohawk because it enables qdm2, SCUMM because it is big, TUCKER because it is small, and SCI because it should not pull in qdm2 but still uses the qt decoder.

Results:

Output of "size scummvm.elf"
           text	   data	    bss	    dec	    hex	filename
TUCKER: 1187852	   7696	  35336	1230884	 12c824	scummvm.elf
   SCI: 1875224	  11120	  44148	1930492	 1d74fc	scummvm.elf
 SCUMM: 1924568	   5800	  36716	1967084	 1e03ec	scummvm.elf
MOHAWK: 1381180	   7904	 574896	1963980	 1df7cc	scummvm.elf

Size of scummvm.nds in bytes:
TUCKER: 1216064
   SCI: 1906752
 SCUMM: 1950784
MOHAWK: 1409600  <- note how this is about 500kb smaller than the .elf!

As you can see, the mohawk scummvm.elf indeed contains the qdm2 induced BSS segment with 512kb data. But it seems this is gone in the .nds -- but anyway, even with that, it's about as big as the SCI and SCUMM binaries. Yet, maybe that is already too big for the nds... Neil will have to tell us.


For further reference, some more data:


The biggest non-engine *.o files, according to their TEXT segment size:
fingolfin at beta:~/scummvm/builds/ds$ size */*.a |sort -nr |head -n 10
  74413	      0	      0	  74413	  122ad	ThemeEngine.o (ex gui/libgui.a)
  56424	      0	      0	  56424	   dc68	ThemeParser.o (ex gui/libgui.a)
  50744	      0	      0	  50744	   c638	options.o (ex gui/libgui.a)
  48188	      0	      0	  48188	   bc3c	launcher.o (ex gui/libgui.a)
  28124	      0	      0	  28124	   6ddc	about.o (ex gui/libgui.a)
  25396	      0	      0	  25396	   6334	qt_decoder.o (ex video/libvideo.a)
  24676	      0	      0	  24676	   6064	VectorRendererSpec.o (ex graphics/libgraphics.a)
  23416	      8	      4	  23428	   5b84	config-manager.o (ex common/libcommon.a)
  20844	      0	      0	  20844	   516c	saveload.o (ex gui/libgui.a)
  19268	      0	      0	  19268	   4b44	widget.o (ex gui/libgui.a)

Sorted by DATA segment size:
fingolfin at beta:~/scummvm/builds/ds$ size */*.a |cut -f2-|sort -nr |head -n 5
   1174	   2048	  19718	   4d06	adlib.o (ex audio/libaudio.a)
     20	      0	    132	     84	version.o (ex base/libbase.a)
      8	      4	  23428	   5b84	config-manager.o (ex common/libcommon.a)
      8	     12	   6084	   17c4	plugins.o (ex base/libbase.a)
      4	      4	   3488	    da0	debug.o (ex common/libcommon.a)

For the mohawk build, this is on position 2:
    136	 539576	 595684	  916e4	qdm2.o (ex video/libvideo.a)


Sorted by BSS segment size:
fingolfin at beta:~/scummvm/builds/ds$ size */*.a |cut -f3-|sort -nr |head -n 5
   2048	  19718	   4d06	adlib.o (ex audio/libaudio.a)
   1025	  12005	   2ee5	unarj.o (ex common/libcommon.a)
    748	  14116	   3724	mame.o (ex audio/libaudio.a)
    646	  12010	   2eea	ds-fs.o (ex backends/libbackends.a)
     32	    588	    24c	scaler.o (ex graphics/libgraphics.a)

For the mohawk build, this is on position 1:
 539576	 595684	  916e4	qdm2.o (ex video/libvideo.a)



Cheers,
Max



More information about the Scummvm-devel mailing list