Mail Archives: djgpp/2000/04/17/08:58:21

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: <>
References: <Pine DOT LNX DOT 4 DOT 10 DOT 10004161837540 DOT 1138-100000 AT darkstar DOT grendel DOT net> <38F9D717 DOT 9438A3F6 AT mtu-net DOT ru>
NNTP-Posting-Host: (
Mime-Version: 1.0
X-Trace: 955975559 8008683 (16 [17104])
X-Posting-Agent: Hamster/
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

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019