Skip to content

Instantly share code, notes, and snippets.

View MrStonedOne's full-sized avatar
🎯
Focusing

Kyle Spier-Swenson MrStonedOne

🎯
Focusing
View GitHub Profile
/world/turf = /turf/open/space/basic
/turf
icon = 'space.dmi'
icon_state = "0"
name = "\proper space"
var/intact = 0
plane = -95
layer = 8.5
var bv1 = 91.21312
var bv12 = 91.21323

server mem usage:

Prototypes:

  • obj: 2156 (20)
  • mob: 2172 (1)
  • proc: 7452 (53)
  • str: 16496 (586)
  • appearance: 17576 (5)
  • id array: 10580 (117)
  • map: 8248 (255,255,0)
@MrStonedOne
MrStonedOne / 0-runtime-LOWMEMORYMODE-z1-only.mem.txt
Created June 3, 2018 09:55
Memory usage. Only non-zero entries.
mem:Research(init):218877952-218513408=364544
mem:Events(init):219054080-218877952=176128
mem:Ticker(init):219185152-219054080=131072
mem:_maps/map_files/debug/runtimestation.dmm(mapload):219267072-219185152=81920
mem:_maps/map_files/debug/runtimestation.dmm(mapload):232235008-230727680=1507328
mem:_maps/RandomRuins/SpaceRuins/derelict6.dmm(mapload):233132032-233123840=8192
mem:_maps/shuttles/emergency_arena.dmm(mapload):233136128-233132032=4096
mem:/turf/closed/wall/r_wall(new()):208896
mem:/obj/machinery/light(new()):65536
mem:/obj/machinery/airalarm/unlocked(new()):65536
CREATE TABLE `tgstation13`.`ss13role_time_log` ( `id` BIGINT NOT NULL AUTO_INCREMENT , `ckey` VARCHAR(32) NOT NULL , `job` VARCHAR(128) NOT NULL , `delta` INT NOT NULL , `datetime` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`), INDEX (`ckey`), INDEX (`job`), INDEX (`datetime`)) ENGINE = InnoDB;
DELIMITER
$$
CREATE TRIGGER `tgstation13`.`ss13role_timeTlogupdate`
AFTER UPDATE
ON `tgstation13`.`ss13role_time` FOR EACH ROW
BEGIN
INSERT into ss13role_time_log (ckey, job, delta) VALUES (NEW.CKEY, NEW.job, NEW.minutes-OLD.minutes);
END
@MrStonedOne
MrStonedOne / byondmemory.dm
Created February 7, 2018 22:29
byond memory usage of lists vs datums
//run verb, give it its memory usage as it asks, be sure to wait 5 seconds from when it asks to when you enter the data. use process explorer for best results. Use dd -> ds, not direct ds run, re-launch dd between tests
#define SAMPLE_SIZE 1000000
/client/verb/memorytest()
var/startingmemory = input("memory usage (kb)") as num
var/list/lists = new (SAMPLE_SIZE)
var/listemptymemory = input("memory usage (kb)") as num
for (var/i in 1 to lists.len)
lists[i] = list()
var/listfullmemory = input("memory usage (kb)") as num
debug=status
Connections: Telnet @127.000.000.001
Run Time: 17.92s
debug=profile
CPU Profile Report for 512testing
[stop][refresh][clear]
Status: profiling: [Total] [Average]
Proc Self CPU Time Total CPU Time Real Time Calls
@MrStonedOne
MrStonedOne / Sorted.txt
Created December 16, 2017 09:37
compile time by proc.
This file has been truncated, but you can view the full file.
22.1503s loading tgstation.dme
0.2957s code\modules\admin\topic.dm:16:error: src.procstart: undefined var
0.1507s code\modules\research\designs.dm:56:error: procstart: undefined var
0.1419s code\__DATASTRUCTURES\stacks.dm:73:error: src.procstart: undefined var
0.1332s code\__DATASTRUCTURES\priority_queue.dm:94:error: src.procstart: undefined var
0.1256s code\datums\mind.dm:795:error: src.procstart: undefined var
0.0900s code\modules\admin\player_panel.dm:314:error: src.procstart: undefined var
0.0884s code\modules\research\designs.dm:57:error: src.procstart: undefined var
0.0834s code\modules\admin\secrets.dm:94:error: src.procstart: undefined var
0.0761s code\game\machinery\computer\medical.dm:203:error: src.procstart: undefined var
Profile results (total time)
Proc Name Self CPU Total CPU Real Time Calls
---------------------------------------------------------- --------- --------- --------- ---------
/proc/testprocoverhead_enhanced_global_empty_return_extra 4.664 4.808 4.973 1496620
/proc/testprocoverhead_enhanced_global_empty_return 4.506 4.639 4.814 1503078
/proc/testprocoverhead_enhanced_global_empty 4.703 4.827 5.003 1496369
/proc/testprocoverhead_enhanced_global_5var_return_extra 5.780 5.927 6.087 1499840
/proc/testprocoverhead_enhanced_global_5var_return 5.690 5.841 6.027 1507978
/proc/testprocoverhead_enhanced_global_5var 5.615 5.752 5.942 1498705
/proc/testprocoverhead_enhanced_global_5arg_return_extra
@MrStonedOne
MrStonedOne / proc overhead profiling.dm
Created December 6, 2017 05:26
proc overhead profiling
/proc/noop()
return
/mob
#define SECONDS *10
#define MINUTES SECOND*60
verb/testprocoverhead_enhanced()
var/end = world.timeofday+60 SECONDS
while (world.timeofday < end)
testprocoverhead_enhanced_chain()