Originally posted by Ssseth
[B]Why would I have to worry about function calls? Everything would be installed on my PC and the software only looks at the CD periodically to make sure it's there right?
FYI the above is all just curious questions. I only have a limited number of games and no kids so I don't try and copy my games: hence me being a n00b this subject. :iagree: [/B]
You don't need to worry about function calls. Microsoft and the authors of Daemon tools have done that for you, asn well as a bunch of people that wrote the interface toyour IDE controller, etc.
Going all the way back to computer programming theory at 2nd yr uni....
Function calls are the most expensive operation (delay wise) that can be peformed. Processors were created to crunch numbers, not make decisions. So the pipes were created in accordance with the cache to ensure that the actual ALU has enough numbers to keep it going.
Basically each CPU pipe has 8 (or more nowadays) operations in the queue. When it reaches a decision operation (if this, otherwise do that) , in the pipe are already 7 operations which it has "Predicted" that will be the resulting path. However if the decision goes the opposite way, the 7 operations have to be cleared one after the other and the correct (next 8) operations from the opposite branch loaded.
Not just that, but also the actual data for the instructions/ops has to be loaded as well from ram/cache which is extremely slow.
Nowadays though, the CPU's have heaps of additional units and much better prediction algorithmns to minimise the delay when switching tasks / or making decisions. I remember the Athlon actually loads 4 ops of the predicted branch and 3 of the opposite branch in order to minimise the delay (only 3 or 4 ops need to be cleared from the pipes if wrong) which basically 1/2's the delay time when switching between functions.
Now when it calls a function, it is basically making a decision, so operations and data need to be retrieved from Ram/Cache to run that function.
If in an operation we can minimise the function calls and make it a serial program (minimise decisions) then it will speed up the computer many times as it doesn't have wasted cycles clearing the pipe or waiting for data/ops to arrive.
Very time consuming.
So if we have something which calls 3 functions to get a job done, it will be much faster than calling 7 to do the same job.
Now don't pull me up for the MAC os which is a RISC chip, which actually relies on craploads of function calls to make the system faster.
Think more like C++ versus Java.
Java programmers create programs faster by linking together thousands of pre-made functions that have been written for them.
What they don'ty see in the background is pre-made java function calling upon other java functions, layer after layer after layer of function calls.
Nasty! Hideously slow. Devolopment time is fast though.
C++, some basic functions are written, but are usually accessed directly. C++ programmers have almost direct control over what the their program is doing.
Only a few layers of function calls. Very fast to execute.
Of course programs take forever to create, and are error prone