Created
February 7, 2018 22:29
-
-
Save MrStonedOne/eef5dca7536aee6b10f5aa72964aec11 to your computer and use it in GitHub Desktop.
byond memory usage of lists vs datums
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
//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 | |
var/list/datums = new (SAMPLE_SIZE) | |
var/datumemptymemory = input("memory usage(kb)") as num | |
for (var/i in 1 to datums.len) | |
datums[i] = new /datum() | |
var/datumfullmemory = input("memory usage(kb)") as num | |
world << "Memory usage of list of lists with [num2text(SAMPLE_SIZE,99)] null values [num2text(listemptymemory - startingmemory, 99)]kb ([num2text((listemptymemory - startingmemory)/SAMPLE_SIZE*1024, 99)] bytes per unit)" | |
world << "Memory usage of list of lists with [num2text(SAMPLE_SIZE,99)] list values [num2text(listfullmemory - listemptymemory, 99)]kb ([num2text((listfullmemory - listemptymemory)/SAMPLE_SIZE*1024, 99)] bytes per unit)" | |
world << "Memory usage of list of datums with [num2text(SAMPLE_SIZE,99)] null values [num2text(datumemptymemory - listfullmemory, 99)]kb ([num2text((datumemptymemory - listfullmemory)/SAMPLE_SIZE*1024, 99)] bytes per unit)" | |
world << "Memory usage of list of datums with [num2text(SAMPLE_SIZE,99)] datum values [num2text(datumfullmemory - datumemptymemory, 99)]kb ([num2text((datumfullmemory - datumemptymemory)/SAMPLE_SIZE*1024, 99)] bytes per unit)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment