Mail Archives: djgpp/1998/12/31/10:35:00
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 -