-
Notifications
You must be signed in to change notification settings - Fork 0
/
experiment4.1_compression.py
49 lines (37 loc) · 4.32 KB
/
experiment4.1_compression.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from pyimplementation.pyarcade import write
import pyimplementation.global_encoding as global_encoding
import pandas as pd
df = pd.read_csv("reprod_datasets/mag_synthetic/affszipf13random.csv") # edit with csv input file path
import timeit
print('Local random zipf 1.3, time:',timeit.timeit('write("zipf13rand.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global random zipf 1.3, time:',timeit.timeit('global_encoding.write_global(df,"zipf13rand.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive random zipf 1.3, time:', timeit.timeit('write("zipf13rand.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1) )
print('Indirect random zipf 1.3, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf13rand.unindirect",0,65535)', globals=globals(), number=1))
df.sort_values(by=['c'],inplace=True)
df = df.reset_index(drop=True)
print('Local sorted zipf 1.3, time:',timeit.timeit('write("zipf13sorted.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global sorted zipf 1.3, time:',timeit.timeit('global_encoding.write_global(df,"zipf13sorted.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive sorted zipf 1.3, time:',timeit.timeit('write("zipf13sorted.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1))
print('Indirect sorted zipf 1.3, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf13sorted.unindirect",0,65535)', globals=globals(), number=1))
df = pd.read_csv("reprod_datasets/mag_synthetic/affszipf07random.csv") # edit with csv input file path
print('Local random zipf 0.7, time:',timeit.timeit('write("zipf07rand.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global random zipf 0.7, time:',timeit.timeit('global_encoding.write_global(df,"zipf07rand.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive random zipf 0.7, time:',timeit.timeit('write("zipf07rand.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1))
print('Indirect random zipf 0.7, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf07rand.unindirect",0,65535)', globals=globals(), number=1))
df.sort_values(by=['c'],inplace=True)
df = df.reset_index(drop=True)
print('Local sorted zipf 0.7, time:',timeit.timeit('write("zipf07sorted.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global sorted zipf 0.7, time:',timeit.timeit('global_encoding.write_global(df,"zipf07sorted.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive sorted zipf 0.7, time:',timeit.timeit('write("zipf07sorted.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1))
print('Indirect sorted zipf 0.7, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf07sorted.unindirect",0,65535)', globals=globals(), number=1))
df = pd.read_csv("reprod_datasets/mag_synthetic/affszipf0random.csv") # edit with csv input file path
print('Local random zipf 0, time:',timeit.timeit('write("zipf0rand.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global random zipf 0, time:',timeit.timeit('global_encoding.write_global(df,"zipf0rand.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive random zipf 0, time:',timeit.timeit('write("zipf0rand.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1))
print('Indirect random zipf 0, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf0rand.unindirect",0,65535)', globals=globals(), number=1))
df.sort_values(by=['c'],inplace=True)
df = df.reset_index(drop=True)
print('Local sorted zipf 0, time:',timeit.timeit('write("zipf0sorted.localdiff", df, row_group_offsets=65535, format="LOCAL")', globals=globals(), number=1))
print('Global sorted zipf 0, time:',timeit.timeit('global_encoding.write_global(df,"zipf0sorted.unorderedglob",0,65535)', globals=globals(), number=1))
print('Adaptive sorted zipf 0, time:',timeit.timeit('write("zipf0sorted.diff", df, row_group_offsets=65535, format="ADAPTIVE")', globals=globals(), number=1))
print('Indirect sorted zipf 0, time:',timeit.timeit('global_encoding.write_indirect(df,"zipf0sorted.unindirect",0,65535)', globals=globals(), number=1))