ID:1277182
 
Applies to:DM Language
Status: Open

Issue hasn't been assigned a status value.
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)
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.
Guess what
BYONDs compiler has no optimization
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>
retval

instead of
push 1
retval
In response to Tobba
Tobba wrote:
Oh jesus christ people

The point is that [snip...]

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

world
loop_checks = 0

mob/verb/Test()
var/start = world.timeofday
for (var/i = 0; i < 10000000; i++)
abs(NORTH)
world << world.timeofday-start

mob/verb/Test2()
var/start = world.timeofday
for (var/i = 0; i < 10000000; i++)
abs(1)
world << world.timeofday-start


18
15


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
BYONDs compiler has no optimization

That's where the real problem is in this case.
Bumping this since we got math optimizations, it shouldent break anything if changed, but code that references these a lot in big loops get a decent speedup