summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.fnl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/utils.fnl b/lib/utils.fnl
index 3220952..fcc235c 100644
--- a/lib/utils.fnl
+++ b/lib/utils.fnl
@@ -2,4 +2,10 @@
(local (ok? result) ...)
(if ok? result (error result)))
-{: must}
+(fn measure [what f]
+ (local start (luna.utf8.now))
+ (local res (table.pack (f)))
+ (print (.. what ": " (/ (- (luna.utf8.now) start) 1e6)))
+ (values (table.unpack res)))
+
+{: must : measure}