From 80fe00cabaffca9316716ce6941fd2ad588c7ac4 Mon Sep 17 00:00:00 2001 From: themodernhakr Date: Sun, 23 Mar 2025 01:34:43 -0500 Subject: [PATCH] Add index lookup in benchmark test --- src/database/database.jmc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/database/database.jmc b/src/database/database.jmc index c09d8fa..d396ae6 100644 --- a/src/database/database.jmc +++ b/src/database/database.jmc @@ -62,14 +62,14 @@ class database.benchmark { function arrayTest2.setup() { ::database.test.arrayTest2.array = []; - ::database.test.arrayTest2.index = []; + ::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]}; + ::database.test.arrayTest2.index += {entryHardcode.calc([index]+1): [index]}; } ); } @@ -84,8 +84,12 @@ class database.benchmark { ::database.test.arrayTest2.index.del(); } function arrayTest2.run() { - ::temp.keyword = {keyword: "entry500"}; - execute run { $say "found: $(keyword)"; } with ::temp.keyword; + ::temp.keyword = "entry500"; + execute run { + ::temp.index = ::database.test.arrayTest2.index.$(keyword); + tellraw @a {"nbt":"temp.index","storage":"ferdinland:ferdinland"}; + } with ::temp.keyword; ::temp.keyword.del(); + ::temp.index.del(); } }