delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/13/03:24:29

Message-ID: <3441CC6B.1CE7@seanet.com>
Date: Mon, 13 Oct 1997 00:23:23 -0700
From: "Alan M. Doerhoefer" <aland AT seanet DOT com>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
CC: djgpp AT delorie DOT com
Subject: FYI: speed of Allegro/DJGPP

This is my testament to the speed of DJGPP and Allegro:

I have been trying to speed up a simple Fractal program
I wrote so that it's fast enough for a 486. I am interested
in the exact Mandelbrot set, so my program begins by
generating the entire set using 256 iterations per test for
each pixel. Initially, I wrote it for Win32 with the dreadfully
slow SetPixel function and without DirectX. Of course, this 
was UNBELIEVABLY SLOW. So I went back to DJGPP and Allegro, chose
Mode X ,320 x 240, and my program suddenly became VERY FAST, as 
expected. What used to take many minutes on my Pentium 100 now
took 7 SECONDS. This was perfect: thanks D.J., Shawn, and everyone
else. However, I sent my program to my brother, who uses a 486 DX2,
and he responded by explaining that it was TOO SLOW to hold his
attention. 
        
So I set out to make a version faster than my Allegro version. I 
experimented with my old Borland C++ 3.0 and TASM 3.0. I wrote
my own TASM routine to write directly to VGA in Mode 13 and linked
it to C code identical to my Allegro version except for putpixel.
Then I tried different combinations of optimizing levels and or 
inline assembler. I even wrote a Mode X version just for fun. 
Here is my inline asm for Mode 13h: (thanks A. LaMothe)

        asm {    
                 mov     di, 0a000h
                 mov     es, di
                 mov     di, y
                 shl     di, 6
                 mov     bx, di
                 shl     di, 2
                 add     di, bx
                 add     di, x
                 mov     al, BYTE PTR color
                 mov     es:[di], al
        }

All tests done on my Pentium 100 and the same CL-5434 graphics board:
frac with Win32:                200 + seconds
frac with bcc, tasm, Mode X     25 seconds
frac with bcc, tasm, Mode 13h   14 seconds
frac with DJGPP,Allegro,Mode X  7 seconds

Allegro and DJGPP are FAST, at least under these circumstances.
Does anyone know where all this speed is coming from? I assume
it is mainly because of two reasons: 1.) The latest DJGPP gcc is
32 bit & well optimized for the 486 2.) Allegro's putpixel is well
written.


-- 
______________________________
Alan M. Doerhoefer:
aland AT seanet DOT com
http://www.seanet.com/~aland/

- Raw text -


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