Changeset: b4cbc269386d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b4cbc269386d
Added Files:
        monetdb5/mal/Tests/uselecttest.mal
Branch: default
Log Message:

Secure select test run
This scripts explores different ways to select from a table.
It is primarilly used for performance assessment.


diffs (truncated from 417 to 300 lines):

diff --git a/monetdb5/mal/Tests/uselecttest.mal 
b/monetdb5/mal/Tests/uselecttest.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/uselecttest.mal
@@ -0,0 +1,412 @@
+n := 100000000:int;
+io.printf("\ninput count: %9lld\n", n);
+
+include microbenchmark;
+b := microbenchmark.uniform(0:oid,n,n);
+
+function user.doit ( b:bat[:oid,:int] , n:int , x1:int , x2:int ) :void;
+
+       a := algebra.uselect(b,x1,x2);
+       c := aggr.count(a);
+       io.printf("\npredicate: %9d <= x <= %9d; result count: %9lld\n", x1, 
x2, c);
+
+       io.printf("1 slice, sequential:\ttime:");
+       t0 := alarm.time();
+               a1 := algebra.uselect(b,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+       io.printf("1 slice, parallel:\ttime:");
+       t0 := alarm.time();
+       barrier P0 := language.dataflow();
+               a1 := algebra.uselect(b,x1,x2);
+       exit P0;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P0 := language.dataflow();
+               a1 := algebra.uselect(b,x1,x2);
+       exit P0;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P0 := language.dataflow();
+               a1 := algebra.uselect(b,x1,x2);
+       exit P0;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+
+       io.printf("2 slices, sequential:\ttime:");
+       m := n/2;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       t1 := alarm.time();
+       t2 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       t1 := alarm.time();
+       t2 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       t1 := alarm.time();
+       t2 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+       io.printf("2 slices, parallel:\ttime:");
+       m := n/2;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       t0 := alarm.time();
+       barrier P1 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       exit P1;
+       t1 := alarm.time();
+       t2 := alarm.time(); 
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P1 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       exit P1;
+       t1 := alarm.time();
+       t2 := alarm.time(); 
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P1 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+       exit P1;
+       t1 := alarm.time();
+       t2 := alarm.time(); 
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+
+       io.printf("4 slices, sequential:\ttime:");
+       m := n/4;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b3 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b4 := algebra.slice(b,m0,m1);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+       io.printf("4 slices, parallel:\ttime:");
+       m := n/4;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b3 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b4 := algebra.slice(b,m0,m1);
+       t0 := alarm.time();
+       barrier P2 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       exit P2;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P2 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       exit P2;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+       barrier P2 := language.dataflow();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+       exit P2;
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+
+       io.printf("8 slices, sequential:\ttime:");
+       m := n/8;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b3 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b4 := algebra.slice(b,m0,m1);
+       m0 := 0;
+       m1 := m - 1;
+       b5 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b6 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b7 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b8 := algebra.slice(b,m0,m1);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+               a5 := algebra.uselect(b5,x1,x2);
+               a6 := algebra.uselect(b6,x1,x2);
+               a7 := algebra.uselect(b7,x1,x2);
+               a8 := algebra.uselect(b8,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+               a5 := algebra.uselect(b5,x1,x2);
+               a6 := algebra.uselect(b6,x1,x2);
+               a7 := algebra.uselect(b7,x1,x2);
+               a8 := algebra.uselect(b8,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       t0 := alarm.time();
+               a1 := algebra.uselect(b1,x1,x2);
+               a2 := algebra.uselect(b2,x1,x2);
+               a3 := algebra.uselect(b3,x1,x2);
+               a4 := algebra.uselect(b4,x1,x2);
+               a5 := algebra.uselect(b5,x1,x2);
+               a6 := algebra.uselect(b6,x1,x2);
+               a7 := algebra.uselect(b7,x1,x2);
+               a8 := algebra.uselect(b8,x1,x2);
+       t1 := alarm.time();
+       t := t1 - t0;
+       io.printf(" %5lld ms", t);
+       io.printf("\n");
+
+       io.printf("8 slices, parallel:\ttime:");
+       m := n/8;
+       m0 := 0;
+       m1 := m - 1;
+       b1 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b2 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b3 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b4 := algebra.slice(b,m0,m1);
+       m0 := 0;
+       m1 := m - 1;
+       b5 := algebra.slice(b,m0,m1);
+       m0 := m0 + m;
+       m1 := m1 + m;
+       b6 := algebra.slice(b,m0,m1);
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to