delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/31/10:35:00

Message-ID: <368B9910.4093EF7D@gmx.de>
Date: Thu, 31 Dec 1998 16:32:32 +0100
From: Christian Hofrichter <ChristianHofrichter AT gmx DOT de>
X-Mailer: Mozilla 4.5 [de]C-CCK-MCD QXW03201 (Win95; I)
X-Accept-Language: de,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: cache misses, slowing down memory-writes dramaticly ?
Reply-To: djgpp AT delorie DOT com

I used a Bresenham algorithm to draw a line on the screen. This was
relative fast.
Then I decided to write with this algorithm to a buffer in the memory to
test how fast the algorithm really is (and to see how many time it
spends with the wait states of the video-memory ) but what I saw was not
fine. I took about 7 or 8 time longer than writing to the screen !
Could that be true, I mean even when the cpu cache cannot work
efficiently (because when drawing a diagonal line the addresses, were to
write to, have a big distance between each other) it should be faster
than writing to the screen.
Without writing to the memory  it took about 30 microseconds (the
calculation). With writing to the memory it took something about 1700
microseconds and more !! And that for a few, silly bytes.
Then I executed the "memset"-function to fill the buffer before writing
to it, and suddenly it took only 200-300 microseconds so I thinks it is
the cpu-cache which slows down the program. But I am not sure.
Has anyone already made such experiences ?
If this could be cache-misses what can I do to avoid that ?
I mean what if I want to do all graphic operations on a virtual buffer,
to copy it to the screen at whole ? That not such a bad idea, because
when doing complex graphic operations (e.g 3D-graphic ) one should not
have to wait for the wait states of the video-memory.  And then, when
the image is completely calculated one could copy it to the screen at
whole.


- Raw text -


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