ID:1277182
May 27 2013, 7:43 am
|
|||||||
| |||||||
They're constants right now, which means that referencing them is hilariously slow (although, you can change them at runtime!) because each usage of them generates a GET instruction instead of PUSH (which is a whole shitload faster)
|
May 27 2013, 10:44 am (Edited on May 27 2013, 10:50 am)
|
|
I'm pretty sure there are constants to avoid future problematic reasons. If they are defines, they will not show up in the debugger. With a constant, you can pin-point its address, e.t.c. For the record, any modern C/C++ compiler should optimize a constant as if it were a define. There are scenarios you need to carefully consider when choosing between the two.
|
And while you're at it, shorten their names to single-letter defines. Typing out all those extra letters is sure to slow game design to such a crawl that no one will be able to create games, because of this immensely missing optimization.
Hm. |
Oh jesus christ people
The point is that for example
return NORTH
Generates the bytecode get global<NORTH> instead of push 1 |
In response to Tobba
|
|
Tobba wrote:
Oh jesus christ people I'm well aware of what the point is. Did you understand my point, though? Your request is slightly similar to a situation with my algorithms professor, who spent 6 months on a paper that no one would publish. In it he detailed eliminating certain optimized statements and replacing them with something similar, thus saving 45 nanoseconds for arrays of sizes 2^48 and above, or so. It simply does not matter, ever. |
Except decoding a variable reference coupled with a variable lookups is extremely slow
|
#define DEBUG 18 Thats a 16% speedup (It'll complain that the statements have no effect, and then compile them in anyways, woo) You'd notice a greater speedup if it wasent for that loops are extremely slow |
The fact that you're referencing a 16% relative speedup means that you've 100% missed the point. Oh well.
|
In response to Tobba
|
|
Tobba wrote:
Guess what That's where the real problem is in this case. |