Skip to content
Snippets Groups Projects
Commit 97487bc7 authored by Bert Palm's avatar Bert Palm 🎇
Browse files

minor improvements

parent 380b71e7
No related branches found
No related tags found
No related merge requests found
import gc
from dios.profiling.generate_testsets import _gen_testset
from dios.profiling.generate_testsets import get_testset, _gen_testset
def calc_mem(rows, cols, shifted=False, dtypesz=(64 / 8)):
......@@ -39,20 +39,20 @@ if __name__ == '__main__':
# dos - linear in rows and colums, same size for r=10,c=100 or r=100,c=10
do_real_check = True
cols = 10
rows = 1000
rows = 100000
# rows = rows_by_time(nsec=600, mdays=365*2)
mem = calc_mem(rows, cols, shifted=False)
memsh = calc_mem(rows, cols, shifted=True)
df, dos = _gen_testset(rows, cols, disalign=False, randstart=True)
df, _, _, dos = get_testset(rows, cols, disalign=False, randstart=True)
dos_mem = dos.memory_usage()
print(f"dos:\n-----------")
print("mem: ", *bytes2hread(dos_mem))
print("entries:", sum([len(dos[e]) for e in dos]))
print()
ratio = round(dos_mem / mem, 2), round(dos_mem / memsh, 2)
ratio = (1 / (memsh - mem) ) * dos_mem
mem = bytes2hread(mem)
memsh = bytes2hread(memsh)
......@@ -66,8 +66,7 @@ if __name__ == '__main__':
print("entries:", rows * cols)
print()
print(f"dos/(df best case) :{ratio[0]}")
print(f"dos/(df worst case) :{ratio[1]}")
print(f"dfbest, dos, dfworst: 0%, {round(ratio, 4)*100}%, 100% ")
if not do_real_check:
exit(0)
......@@ -88,7 +87,7 @@ if __name__ == '__main__':
print()
print('rand start, rand freq')
df, _ = _gen_testset(rows, cols, disalign='random', randstart=True)
df, _ = get_testset(rows, cols, disalign='random', randstart=True)
df.info(memory_usage='deep', verbose=False)
print("entries:", sum([len(df[e]) for e in df]))
......
......@@ -107,9 +107,9 @@ if __name__ == '__main__':
# max increase of of rows
# 1 = 10 # 2 = 100 # .... # 5 = 100'000
iterations = 4
iterations = 5
runs = 10
cols = 20
cols = 70
profile_assignment = True
......@@ -117,7 +117,7 @@ if __name__ == '__main__':
use_df = True
use_a = False
use_b = False
use_dos = False
use_dos = True
# plot options
normalize_to_df = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment