diff tests/_perf_config.py @ 532:c2947ac74b0c

Add timing for non-cached interpolations: using the PY: namespace
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 20 Dec 2021 22:45:24 +0100
parents d803321d927b
children e43db776f80a
line wrap: on
line diff
--- a/tests/_perf_config.py	Mon Dec 20 22:31:58 2021 +0100
+++ b/tests/_perf_config.py	Mon Dec 20 22:45:24 2021 +0100
@@ -68,6 +68,13 @@
     print("expand-string-once: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key11")', setup=setup, number=num))
     print("-"*50)
 
+if all or "expand-string-once-noncached" in opts:
+    print("expand-string-once-noncached: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key12")', setup=setup, number=num))
+    print("expand-string-once-noncached: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key12")', setup=setup, number=num))
+    print("expand-string-once-noncached: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key12")', setup=setup, number=num))
+    print("expand-string-once-noncached: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key12")', setup=setup, number=num))
+    print("-"*50)    
+
 if all or "expand-string-many" in opts:
     print("expand-string-many: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key10")', setup=setup, number=num))
     print("expand-string-many: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key10")', setup=setup, number=num))
@@ -75,6 +82,13 @@
     print("expand-string-many: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key10")', setup=setup, number=num))
     print("-"*50)
 
+if all or "expand-string-many-noncached" in opts:
+    print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", u"key13")', setup=setup, number=num))
+    print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", u"key13")', setup=setup, number=num))
+    print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key13")', setup=setup, number=num))
+    print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key13")', setup=setup, number=num))
+    print("-"*50)    
+
 if all or "expand-list" in opts:
     print("expand-list: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key8")', setup=setup, number=num))
     print("expand-list: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key8")', setup=setup, number=num))