From: buers AT gmx DOT de (Dieter Buerssner) Newsgroups: comp.os.msdos.djgpp Subject: Re: inefficiency of GCC output code & -O problem Date: 17 Apr 2000 12:45:59 GMT Lines: 50 Message-ID: <8df84a.3vvqu6v.0@buerssner-17104.user.cis.dfn.de> References: <38F9D717 DOT 9438A3F6 AT mtu-net DOT ru> NNTP-Posting-Host: pec-115-171.tnt7.s2.uunet.de (149.225.115.171) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: fu-berlin.de 955975559 8008683 149.225.115.171 (16 [17104]) X-Posting-Agent: Hamster/1.3.13.0 User-Agent: Xnews/03.02.04 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Alexei A. Frounze wrote: [Alexei has sent me an (almost) compilable set of sources. Looks quite nice - the graphics;)] >Not really. The inner loop in my tmapper can not be written in pure C. >Belive me. This is not true. >No one compiler figure out such a trick as used in my ASM module. Alexei, then you will surely accept the following bet. Level I: I will replace about half of your inline assembly in T_Map() by C code, that does exactly the same thing. No change of algorithm. Most of the replacement will be your comments. To make the competition fair, I will put in your shift code in inline assembly (with correct constrains), because this was in the original source you posted here, and because the C replacement was my sugestion. But this is really a minor point. I will compile my C version with gcc (2.95.2) -O. It is your choice, whether you want your version compiled with -O or -O2. To compare the performance, I start your program (plain DOS, AMD K6-2), wait a little bit, write down the FPS display, and stop it again with ESC. I bet my version will be faster! If I win, you send me 100 g of the best Russian caviar (you will have to pay the toll, if any, as well). When I loose, I will send you the nicely printed sections about inline assembly and constraints of the gcc manual by snail mail to Russia;) Game over, when I loose, otherwise ... Level II: I get rid of all your inline assembly in T_Map. I will be allowed to add one single line (say less than 50 characters from __asm__ upto the closing ')' ) of inline assembly to your source. I bet, the plain C code will perform about the same, as your inline code. I win, when my code is no more than 2 FPS slower, or faster, than your code (The executable you sent reports 70 FPS here). When I win, you will add to your package a bottle of the best champagne from Crimea. When I loose, I will add Brennan Underwood's tutorial. Especially for you, I will add some hand written notes, where the tutorial doesn't conform with current gcc anymore. In either case, as a bonus, you will receive some code fixes by email. -- SCNR, Dieter