POV-Ray : Newsgroups : povray.off-topic : Teach yourself C++ in 21 days : Re: Teach yourself C++ in 21 strange malfunctions Server Time
29 Jul 2024 16:28:51 EDT (-0400)
  Re: Teach yourself C++ in 21 strange malfunctions  
From: Le Forgeron
Date: 17 Apr 2012 16:46:16
Message: <4f8dd698$1@news.povray.org>
Le 17/04/2012 21:51, Warp nous fit lire :
> the 80's C hackers didn't like that (in the same
> way as they didn't like the idea of spending a clock cycle to initialize
> a variable with a value that would immediately be overwritten anyways).

It was a time where memory access was done by putting the address on the
address bus, and the data was read/write on the data bus (and a wire was
dedicated to indicate if it was a read or write).
A time in which the memory respond time was faster than the CPU clock.
A time you could know the number of cycles to perform an addition, a
multiplication or a division (on integer). And gains a few cycles by
reordering expression.

A time I remember!

And it cost one cycle (may be a bit more, I do not remember the timing
for a move.l) to write a zero to a data bus-wide variable, but as many
cycles for an array. You do not want to waste 40 cycles to erase an
array of 40 int.

You already wasted a cycle to increase the stack usage, and by entering
a function you wasted a few more cycle saving a few registers on it too.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.