I wrote a small test to check for inliningof functions in for loops.
#define CAKE1 ;a += 5;c -= b;d = a + b + c; |
The purpose of this was testing the overhead of calling functions against using macros, i other words inlining the code.
The test verbs show results when using values of at least 1000 000 loops, and as expected the macro version performs better.
The thing is maybe i did my macros wrong :-O, maybe you can tell me if that is the case ;-)
The strange thing is, that after running both versions one or two times, they seem to get faster, and then after a few time the get back to the old performance. (maybe due to my processor changing FSB Frequency)
Does anyone have some information what kind of optimization regarding function inlining the compiler can do?
A few assumptions so far:
- Functions are not inlned
- Functions are not inlned in for-loops
- for-loops are not inlined (if they contain fuctions????)
Possible reasons:
-BYOND allows to add and remove functions and verbs from/to objects, so the compiler may be unable to assure it is the same function called?
-I did my Macros wrong :-)