Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made it go from taking years to hours Removed Datum based recursion, this was unneeded. Fixed it calling a proc for what ended up being a costly noop millions of times (this was a moderate speed up as it would call DoSearchVar on every fucking number or string or null in a things vars list.) Fixed it calling itself on the vars list. luckily it only checked keys, so this didn't stack overflow. I'm intentionally leaving the debugging stuff in right now so that its on the record somewhere. I'll remove that when I pr line by line profiling as its own separate thing
- Loading branch information
1 parent
8d3cc5b
commit ef876c6
Showing
5 changed files
with
112 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
var/list/PROFILE_STORE | ||
var/PROFILE_TIME | ||
var/PROFILE_LINE | ||
var/PROFILE_FILE | ||
var/PROFILE_SLEEPCHECK | ||
|
||
#define PROFILE_START PROFILE_STORE = list();PROFILE_SET | ||
|
||
#define PROFILE_SET PROFILE_TIME = TICK_USAGE_REAL; PROFILE_LINE = __LINE__; PROFILE_FILE = __FILE__; PROFILE_SLEEPCHECK = world.time | ||
|
||
#define PROFILE_TICK if (PROFILE_SLEEPCHECK == world.time) {var/list/PROFILE_ITEM = PROFILE_STORE["[PROFILE_FILE]:[PROFILE_LINE] - [__FILE__]:[__LINE__]"]; if (!PROFILE_ITEM) {PROFILE_ITEM = list(); PROFILE_STORE["[PROFILE_FILE]:[PROFILE_LINE] - [__FILE__]:[__LINE__]"] = PROFILE_ITEM} PROFILE_ITEM["TIME"] += TICK_USAGE_TO_MS(PROFILE_TIME);PROFILE_ITEM["COUNT"]++;} PROFILE_SET | ||
|
||
#define PROFILE_SHOW(USER) sortTim(PROFILE_STORE, /proc/cmp_profile_avg_time_dsc, TRUE);var/list/HTML_PROFILE_LINES = list();for (var/PROFILE_ENTRY in PROFILE_STORE) {HTML_PROFILE_LINES += "[PROFILE_ENTRY] => [num2text(PROFILE_STORE[PROFILE_ENTRY]["TIME"], 10)]ms ([num2text(PROFILE_STORE[PROFILE_ENTRY]["COUNT"], 10)]) (avg:[num2text(PROFILE_STORE[PROFILE_ENTRY]["TIME"]/(PROFILE_STORE[PROFILE_ENTRY]["COUNT"] || 1), 99)]"};USER << browse("<ol><li>[HTML_PROFILE_LINES.Join("</li><li>")]</li></ol>", "window=url_encode(PROFILE_L[__FILE__]:[__LINE__])") | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters