From: "Randy Sorensen" Newsgroups: comp.os.msdos.djgpp Subject: Optimized code, comparing with Borland C++ 4.5 w/ Power Pack Date: Sun, 8 Mar 1998 17:01:04 -0700 Lines: 45 NNTP-Posting-Host: 208.13.36.190 Message-ID: <350334da.0@superego.idcomm.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk It probably goes without saying, but I'm somewhat of a newbie to gcc in general, and especially DJGPP (used gcc on Linux a bit). So if this is a dumb question, you'll just have to shoot me. I bought a book a few weeks ago called _Cutting Edge 3D Game Programming with C++_ by John De Goes. The book has some nice texts on 3D coding, but the way they did the sample code just plain sucks. The author used Borland C++ 4.5, and also used Borland's PowerPack, two things that I don't own. I'm not sure what the PowerPack does, but the code doesen't work with BC++ 4.0 without it, and the folks on IRC say it doesen't work on 4.5 without the PP either. It's DPMI code, and so I figured it would be pretty easy to port it to DJGPP. As it turned out, it was. Which was nice, since code that uses Borland's DPMI manager can only run on DOS (you have to shut down out of Windows). Here's my problem. When I do shut down out of DOS and run the exec's included on the CD, they run up to 60 fps, where as the code that I ported to DJGPP runs at 40 fps with the following optimizations: "-O6 -ffast-math -funroll-loops -finline -m486". Is there any other optimizations that will speed it up? Also, I've heard that using high "-O"'s will cause problems.. should I bring it down to 4 or 3? I should note that when I ported the code, the original author didn't do a very "standard" job with it. Some of the matrix vector and point transformation code was inlined (they were C++ methods) and I couldn't figure out how to make DJGPP inline them. Also, since you can't write to video memory in DJGPP by default, I went about doing so using __djgpp_nearptr_enable() and adding __djgpp_conventional_base to the video memory address. Is there a faster way of going about video memory writing? And lastly, I had to put some extra type-casts in there, since gcc.exe kept giving me warnings about assigning doubles to unsigned char's and stuff. Thanks for all your help :) I'd appreciate it if you emailed me rather than posted a response, since I don't check the groups or the listserv very often. -- -Randy Sorensen randy AT REMOVE_THIS_TO_EMAIL_ME DOT idcomm DOT com You must remove the first part of the domain on my e-mail address to send me mail, or else it will not go through. I'm very sorry for this, but it's the only way I can keep the "Free Live Hot Sex" headers out of my inbox every day. Thanks!