annotate caching-tests/bench.ur @ 2292:23eaec04e0f8

Ran a benchmark!
author Ziv Scully <ziv@mit.edu>
date Tue, 17 Nov 2015 04:08:12 -0500
parents ab6ca12debeb
children 8be54d7bd06e
rev   line source
ziv@2290 1 table tab : {Id : int, Val : int} PRIMARY KEY Id
ziv@2290 2
ziv@2290 3 fun check id =
ziv@2290 4 res <- oneOrNoRows (SELECT tab.Val FROM tab WHERE tab.Id = {[id]});
ziv@2290 5 return <xml><body>
ziv@2292 6 cache
ziv@2290 7 {case res of
ziv@2290 8 None => <xml>?</xml>
ziv@2290 9 | Some row => <xml>{[row.Tab.Val]}</xml>}
ziv@2290 10 </body></xml>
ziv@2290 11
ziv@2290 12 fun flush id =
ziv@2290 13 dml (UPDATE tab SET Val = Val + 1 WHERE Id = {[id]});
ziv@2290 14 return <xml><body>
ziv@2290 15 Changed {[id]}!
ziv@2290 16 </body></xml>