@lazy //takes name of table. metadata must already exist. function createTable(name) { logger(2, database.createTable, "Creating table: $name"); Array.forEach( "ferdinland:ferdinland", "database.tables.$name.fields", ()=>{tellraw @a {"storage":"ferdinland:ferdinland", "nbt":"database.tables.$name.fields[0]"};} ); } class database { @add(__load__) function __init__() {} @add(this.__init__) function schema() {} @add(this.schema) function tables.myTable() { ::database.tables.myTable.name = "myTable"; ::database.tables.myTable.fields = ["one", "two"]; createTable(myTable); } } class database.benchmark { function arrayTest1.setup() { ::database.test.arrayTest1.array = []; Hardcode.repeat( indexString="[index]", start=0, stop=500, function=() => { ::database.test.arrayTest1.array << {id: Hardcode.calc([index]+1), string: "entryHardcode.calc([index]+1)"}; } ); } function arrayTest1.print() { tellraw @a {"nbt":"database.test.arrayTest1.array","storage":"ferdinland:ferdinland"}; } function arrayTest1.clean() { ::database.test.arrayTest1.array.del(); ::temp.arrayTest1.del(); } function arrayTest1.run() { ::temp.arrayTest1 = ::database.test.arrayTest1.array; Array.forEach( "ferdinland:ferdinland", "temp.arrayTest1", () => { if (String.isEqual("ferdinland:ferdinland", "temp.arrayTest1[0].string", "entry500")) { ::temp.result = ::temp.arrayTest1[0]; } if (String.isEqual("ferdinland:ferdinland", "temp.arrayTest1[0].string", "entry500")) { return; } } ); ::temp.arrayTest1.del(); } function arrayTest2.setup() { ::database.test.arrayTest2.array = []; ::database.test.arrayTest2.index = {}; Hardcode.repeat( indexString="[index]", start=0, stop=500, function=() => { ::database.test.arrayTest2.array << {id: Hardcode.calc([index]+1), string: "entryHardcode.calc([index]+1)"}; ::database.test.arrayTest2.index += {entryHardcode.calc([index]+1): [index]}; } ); } function arrayTest2.printArray() { tellraw @a {"nbt":"database.test.arrayTest2.array","storage":"ferdinland:ferdinland"}; } function arrayTest2.printIndex() { tellraw @a {"nbt":"database.test.arrayTest2.index","storage":"ferdinland:ferdinland"}; } function arrayTest2.clean() { ::database.test.arrayTest2.array.del(); ::database.test.arrayTest2.index.del(); } function arrayTest2._searchIndex() { $::temp.index = ::database.test.arrayTest2.index.$(keyword); } function arrayTest2._searchArray() { $::temp.result = ::database.test.arrayTest2.array[$(index)]; } function arrayTest2.run() { this.arrayTest2._searchIndex({keyword: "entry500"}); this.arrayTest2._searchArray() with ::temp; ::temp.index.del(); ::temp.result.del(); } }