changeset 69:f6c53dea71f2 draft

Add util module with decorator for benchmarking
author Lewin Bormann <lbo@spheniscida.de>
date Sat, 25 May 2019 14:50:26 +0200
parents f02036f75ecf
children 3d93b1ac9c29
files pcombinators/util.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pcombinators/util.py	Sat May 25 14:50:26 2019 +0200
@@ -0,0 +1,17 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Thu May 23 22:34:33 2019
+
+@author: lbo
+"""
+
+import time
+
+def time_it(f):
+    def f_(*args, **kwargs):
+        before = time.time()
+        r = f(*args, **kwargs)
+        print(f, time.time()-before)
+        return r
+    return f_