Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: Tal Lavi , djgpp AT delorie DOT com Date: Tue, 8 Sep 1998 15:51:47 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: MAJOR slowdowns in translating TP7 gfx code to DJGPP2: Suple In-reply-to: <35F5CEA2.15AF@post.tau.ac.il> Precedence: bulk Tal Lavi wrote: > > Why do you need `div', anyway? Are you sure you can get away with simple > > 32-bit division? > > I need 'div' so I could calculate the quot AND rem at once, since I need > them both. You can use inline assembler for that. > > This is dead end. _farptr functions are already written in inline > > assembly, and they are as fast as you can get (you *did* compile with -O2, > > did you?), so you won't find any faster way of doing that part. _farptr > > is NOT your problem, look for the reasons of the slow-down elsewhere. > > I tried the -O2 before, but i havn't seen any differnce (probably > because > of the div slowing everything down). > I don't usually trust a compiler to make my program faster. I think gcc will generate faster code than you (without offense), try -O2 and if you won't debug use -fomit-frame-pointer too. -ffast-math (if I remmember well the name) helps for FPU intensive code. > Is that thing safe, anyway? Yes. > Even though the main slowdown is not in the _far*, inlining the memory > writing myself, > will make things easier for the compiler, and will eliminate any chance > for error. > > Besides the stupid div, I could use some optimization with the FlushPage > routine that fills the screen to a certain color in 640x480x64K mode. > Any sugestions? > > void FlushPage(unsigned short C) > { > unsigned long i; > _farsetsel(LFBSelector[ScreenNum]); > for(i=0;i<614400;i+=2) > _farnspokew(i,C); > } Yes, use long instead of words. Use decrement for the loop variable too. SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013