Path: utzoo!mnetor!uunet!mcvax!enea!tut!santra!clinet!msa From: msa@clinet.FI (Markku Savela) Newsgroups: comp.lang.c Subject: Re: cdecl keyword Message-ID: <634@clinet.FI> Date: 2 May 88 17:34:20 GMT References: <7606@brl-smoke.ARPA> <982@micomvax.UUCP> <7682@brl-smoke.ARPA> <994@micomvax.UUCP> Reply-To: msa@clinet.UUCP (Markku Savela) Organization: City Lines Oy, Helsinki, Finland Lines: 43 Keywords: cdecl MSC 4.00 optimizing Summary: Does not seem to affect code size or speed? The recent discussion on "cdecl"-keyword prompted me to test, whether it really would produce faster and/or smaller program in one specific test case. This is just a report of my findings and not intended to re-open the cdecl flame war ...:-) The results were not very promising. The program I've been working with generates about 104k of code. Using "pascal"-calling sequence ("-Gc"-flag) the EXE-size is reduced 4-7k. The effect to the execution speed was insignificant. Here follows some results: MSC 4.00 Flags used EXE-size Speed value (chrs/second) -Gs 172k 260 ("c" calling) -Gs -Gc 168k 250 ("pascal" calling) -Gs -Gc -G2 165k 255 (290) ("pascal" calling) -Gs -Gc -G2 -Oat 164k 255 (290) ("pascal" calling) -Gs -Oat 171k 260 (295) ("c" calling) Notes: a) Flags "-AL -DLINT_ARGS -Gt32 -Gs -W3" were present in all cases b) Code Size is 104k (from map summing all *_TEXT-sizes). The remainder of the EXE-size is some large statically allocated variables and run-time library. c) the speed values should be interpreted very cautiously. They contain significant general overhead (like opening 4-8 files). (should have selected the test more carefully). Actually the program has recently been compiled from Pascal to C and the pascal version measures as follows: Microsoft Pascal 3.31 199k 190 (195) Unfortunately this is not quite comparable, because during the translation process (Pascal -> C) I completely rewrote one VERY BADLY coded module. If the same modifications were done to the original pascal version, the numbers might be something like 190k and 250, or even closer to the C version. "cdecl" is best left to its original purpose -- there doesn't seem to be any reason to use it either for speeding or squeezing the program (perhaps it helps more with small model programs). -- Markku Savela, msa@clinet.fi