Skip to content

Instantly share code, notes, and snippets.

View MrStonedOne's full-sized avatar
🎯
Focusing

Kyle Spier-Swenson MrStonedOne

🎯
Focusing
View GitHub Profile
@MrStonedOne
MrStonedOne / TRIGGER.NTSL
Created April 16, 2016 10:21 — forked from C-F-K/TRIGGER.NTSL
trigonometry automator for telescience on /tg/station13
// TRIGGER.NTSL - trigonometry automator for telescience on /tg/station13
// this isn't accurate enough to steal DAT FUKKEN DISK exactly
// but that's the price you pay for automation.
// it is PLENTY accurate - enough to, say, teleport an EMP grenade into the cap's office
// to take out cameras, then have an accomplice teleport you in to grab the disk yourself.
// and of course with a halfway competent toxins lab it's WAY precise enough for bombs.
// use your imagination.
// iterator function
code/controllers/subsystem/garbage.dm:456 - code/controllers/subsystem/garbage.dm:379 => 1621.765625ms (127435) (avg:0.012726218439638615)
code/controllers/subsystem/garbage.dm:436 - code/controllers/subsystem/garbage.dm:438 => 1082.953125ms (127437) (avg:0.0084979487583041191)
code/controllers/subsystem/garbage.dm:438 - code/controllers/subsystem/garbage.dm:440 => 1023.03125ms (127437) (avg:0.0080277407541871071)
code/controllers/subsystem/garbage.dm:428 - code/controllers/subsystem/garbage.dm:432 => 960ms (127437) (avg:0.0075331339612603188)
code/controllers/subsystem/garbage.dm:432 - code/controllers/subsystem/garbage.dm:434 => 858.453125ms (127437) (avg:0.0067362943664193153)
code/controllers/subsystem/garbage.dm:374 - code/controllers/subsystem/garbage.dm:418 => 824.828125ms (127436) (avg:0.0064724893309175968)
code/controllers/subsystem/garbage.dm:379 - code/controllers/subsystem/garbage.dm:374 => 806.1875ms (127435) (avg:0.0063262642361223698)
code/controllers/subsystem/garbage.dm:447 - code/controller
#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
#define ARRAY_SIZE 500000
#define ACCESS_AMOUNT 5000000
#ifdef packitbaby
#pragma pack(push, 1)
@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()
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 / 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
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 / 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
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