-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathreadspeed.q
53 lines (48 loc) · 2.12 KB
/
readspeed.q
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
47
48
49
50
51
52
53
/ q readspeed.q [-run] [-prepare] [-flush memsizeingb]
/ eg: q readspeed.q -prepare
/ q readspeed.q -flush 32 -run
STDOUT:-1
if[0=count .z.x;STDOUT">q ",(string .z.f)," -prepare -run -flush memsizeGB";exit 1]
argvk:key argv:.Q.opt .z.x
PREPARE:`prepare in argvk
FLUSH:`flush in argvk
RUN:`run in argvk
if[PREPARE;
t:([]hh:100000000?100000h);
update sshh:asc hh from `t;
update ii:`int$2*hh from `t;
update bb:hh=4567h from `t;
update cc:100000000?.Q.A from `t;
rsave `t;
STDOUT"tmp db <t> created"]
if[FLUSH;
STDOUT"memory flushed (",$[count mem:first argv`flush;mem;"1"],"GB)";
key each(floor 1^"E"$first argv`flush)#key 250000000]
if[RUN;
value"\\l t";
STDOUT"* boolean";
STDOUT"from disk";
STDOUT"million records/second(b): ",string floor 0.5+(count t)%1000*value"\\t select i from t where bb=1b";
STDOUT"from memory";
STDOUT"million records/second(b): ",string floor 0.5+(count t)%1000*value"\\t select i from t where bb=1b";
STDOUT"* single char";
STDOUT"from disk";
STDOUT"million records/second(c): ",string floor 0.5+(count t)%1000*value"\\t select i from t where cc=\"x\"";
STDOUT"from memory";
STDOUT"million records/second(c): ",string floor 0.5+(count t)%1000*value"\\t select i from t where cc=\"x\"";
STDOUT"* sorted short";
STDOUT"from disk";
STDOUT"million records/second(`s#h): ",string floor 0.5+(count t)%1000*value"\\t select i from t where sshh=4567h";
STDOUT"from memory";
STDOUT"million records/second(`s#h): ",string floor 0.5+(count t)%1000*value"\\t select i from t where sshh=4567h";
STDOUT"* short";
STDOUT"from disk";
STDOUT"million records/second(h): ",string floor 0.5+(count t)%1000*value"\\t select i from t where hh=4567h";
STDOUT"from memory";
STDOUT"million records/second(h): ",string floor 0.5+(count t)%1000*value"\\t select i from t where hh=4567h";
STDOUT"* int";
STDOUT"from disk";
STDOUT"million records/second(i): ",string floor 0.5+(count t)%1000*value"\\t select i from t where ii=4567i";
STDOUT"from memory";
STDOUT"million records/second(i): ",string floor 0.5+(count t)%1000*value"\\t select i from t where ii=4567i"]
\\