From c7d242233403594d7a5422344a49a16c2c738222 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Fri, 3 Feb 2023 12:58:13 +0300 Subject: Add perf scripts that compare fetching a trait using GN API vs LMDB * scripts/performance/(README,org, timeit_gn2.py, timeit_lmdb.py): New files. Signed-off-by: Munyoki Kilyungi --- scripts/performance/timeit_lmdb.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 scripts/performance/timeit_lmdb.py (limited to 'scripts/performance/timeit_lmdb.py') diff --git a/scripts/performance/timeit_lmdb.py b/scripts/performance/timeit_lmdb.py new file mode 100644 index 00000000..17514667 --- /dev/null +++ b/scripts/performance/timeit_lmdb.py @@ -0,0 +1,36 @@ +import sys +import timeit + +print(timeit.timeit( +""" +PATH = "/home/munyoki/tmp/dataset/HLCPublish/10001/" +env = lmdb.open(PATH) + +BLOB_HASH_DIGEST = 32 + +# def index_matrix(row_pointers): + +with env.begin(write=False) as txn: + current_hash = txn.get(b"current") + matrix_hash = txn.get(current_hash + b":matrix") + row_pointers = txn.get(matrix_hash + + b":row-pointers") + nrows, = struct.unpack("