mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-03-28 23:13:21 +00:00
About The Pull Request Micros lighting objects, and their creation We save a good bit of time by not walking space turfs adjacent to new objects. We also save some time with micros in the actual underlay update logic. I swear dude we spend like 0.8 seconds of init applying the underlay. I want threaded maptick already Micros lighting sources, and corner creation A: Corners were being passed just A turf, and then expected to generatecorners based on that. This is pointless. It is better to instead pass in the coords of the bottom left turf, and then build in a circle. This saves like 0.3 seconds B: We use so many damn datum vars in corner application that we just do not need to. This resolves that, since it pissed me off. It's pointless. Lets cache em instead There's some misc datum var caching going on here too. Lemme see... Oh and a bit of shortcutting for a for loop, since it was a tad expensive on its own. Also I removed the turfs list, because it does fucking nothing. Why is this still here. All my little optimizations save about 1 second of init I think Not great, but not bad, and plus actual lighting work is faster now too Why It's Good For The Game Speed
40 lines
1.4 KiB
Plaintext
40 lines
1.4 KiB
Plaintext
#define STAT_ENTRY_TIME 1
|
|
#define STAT_ENTRY_COUNT 2
|
|
#define STAT_ENTRY_LENGTH 2
|
|
|
|
|
|
#define STAT_START_STOPWATCH var/STAT_STOP_WATCH = TICK_USAGE
|
|
#define STAT_STOP_STOPWATCH var/STAT_TIME = TICK_USAGE_TO_MS(STAT_STOP_WATCH)
|
|
#define STAT_LOG_ENTRY(entrylist, entryname) \
|
|
var/list/STAT_ENTRY = entrylist[entryname] || (entrylist[entryname] = new /list(STAT_ENTRY_LENGTH));\
|
|
STAT_ENTRY[STAT_ENTRY_TIME] += STAT_TIME;\
|
|
STAT_ENTRY[STAT_ENTRY_COUNT] += 1;
|
|
|
|
// Cost tracking macros, to be used in one proc
|
|
// The static lists are under the assumption that costs and counting are global lists, and will therefor
|
|
// Break during world init
|
|
#define INIT_COST(costs, counting) \
|
|
var/list/_costs = costs; \
|
|
var/list/_counting = counting; \
|
|
var/usage = TICK_USAGE;
|
|
|
|
// Cost tracking macro for global lists, prevents erroring if GLOB has not yet been initialized
|
|
#define INIT_COST_GLOBAL(costs, counting) \
|
|
var/static/list/hidden_static_list_for_fun1 = list(); \
|
|
var/static/list/hidden_static_list_for_fun2 = list(); \
|
|
if(GLOB){\
|
|
costs = hidden_static_list_for_fun1; \
|
|
counting = hidden_static_list_for_fun2 ; \
|
|
} \
|
|
INIT_COST(hidden_static_list_for_fun1, hidden_static_list_for_fun2)
|
|
|
|
#define SET_COST(category) \
|
|
do { \
|
|
var/cost = TICK_USAGE; \
|
|
_costs[category] += TICK_DELTA_TO_MS(cost - usage);\
|
|
_counting[category] += 1; \
|
|
} while(FALSE); \
|
|
usage = TICK_USAGE;
|
|
|
|
#define SET_COST_LINE(...) SET_COST("[__LINE__]")
|