www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/06/12:28:23

From: Sengan DOT Short AT durham DOT ac DOT uk
Message-Id: <14197.9606061624@ws-ai5.dur.ac.uk>
Subject: Re: Are near pointers worth it?
To: djgpp AT delorie DOT com
Date: Thu, 6 Jun 1996 17:24:26 +0100 (BST)
In-Reply-To: <9606061003.AA04198@mercury> from "moskewicz@MEM.po.com" at Jun 6, 96 06:03:45 am
Mime-Version: 1.0

> 
> >> and VESA 2 linear frame buffers. If I were to use near pointers would
> >> it make it any faster?
> 
> >I think not. I got about a 5% speedup of my putpixel() function from
> >using near pointers, and that is the absolute worst case becuase it
> >involves a segment load per pixel. If you are just setting the selector
> >once for any more significant drawing tasks, the overhead is so small
> as
> >to be totally insignificant.
> 
> I would agree totally, using near pointers is not worth it. Remember,
> GCC
> doesn't touch %fs and %gs, so just put your selector there, and you only
> load it once. Just watch out for the _far* family, as they will clobber
> %fs
> (though you'd probably be using them for the same selector anyway!).
> A final note: Using far pointers, at best, still costs 1 cycle per pixel
> over
> near pointers, for the seg override, and may screw up P5 pairing, as the
> seg override will not pair, and counts as an instruction (sort of).
> Still, this
> could be 1/100 of a second per frame... I think.

Surely the point is that the access to video memory is so slow that large
variations in execution speed in the processor are masked by the wait states
enforced by the graphics cards. If (ever) some graphics card is introduced
which has the same access time as normal memory is introduced, it seems to me
that difference between the different ways of accessing memory will be clearer.

The other thing is that all depends on your problem, and what tradeoffs are
best for its solution: I might want a fast program accessing hardware really
fast, and not want memory protection for one application, and yet want memory
protection for another.

Instead of a ``near pointers are good/bad'' argument, it would be more
informative to determine the respective speeds of graphics cards, so everyone
can have a data base of them.

Sengan

- Raw text -


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