# HG changeset patch # User ziv@mit.edu # Date 1447629024 18000 # Node ID ab6ca12debeb19eca3c7f60435e5c2ab8ae84c3d # Parent 78820fa8f5a751cdcac5c44b8a0d184632a40819 Add small benchmark (WIP). diff -r 78820fa8f5a7 -r ab6ca12debeb caching-tests/bench.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/caching-tests/bench.ur Sun Nov 15 18:10:24 2015 -0500 @@ -0,0 +1,24 @@ +table tab : {Id : int, Val : int} PRIMARY KEY Id + +fun check id = + res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]}); + return + {case res of + None => ? + | Some row => {[row.Tab.Val]}} + + +fun flush id = + dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]}); + return + Changed {[id]}! + + +fun main x y = + r <- rand; + let + val id = r % x + val doFlush = (r / x) % y = 0 + in + if doFlush then flush id else check id + end diff -r 78820fa8f5a7 -r ab6ca12debeb caching-tests/bench.urp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/caching-tests/bench.urp Sun Nov 15 18:10:24 2015 -0500 @@ -0,0 +1,5 @@ +database host=localhost +sql bench.sql +safeGet Bench/main + +bench diff -r 78820fa8f5a7 -r ab6ca12debeb caching-tests/bench.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/caching-tests/bench.urs Sun Nov 15 18:10:24 2015 -0500 @@ -0,0 +1,1 @@ +val main : int -> int -> transaction page diff -r 78820fa8f5a7 -r ab6ca12debeb caching-tests/test.urp --- a/caching-tests/test.urp Sun Nov 15 14:18:35 2015 -0500 +++ b/caching-tests/test.urp Sun Nov 15 18:10:24 2015 -0500 @@ -1,4 +1,4 @@ -database host=localhost dbname=ziv +database host=localhost sql test.sql safeGet Test/flush safeGet Test/flash