Mercurial > hgrepos > Python > libs > ConfigMix
changeset 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 | be740ed67d16 |
| children | e43db776f80a |
| files | tests/_perf_config.py tests/data/conf_perf.py |
| diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
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))
--- a/tests/data/conf_perf.py Mon Dec 20 22:31:58 2021 +0100 +++ b/tests/data/conf_perf.py Mon Dec 20 22:45:24 2021 +0100 @@ -28,4 +28,6 @@ (u'key9', OrderedDict()), (u'key10', u"1{{key1}}2{{key2}}{{key1}}3{{tree1.tree2.key4}}"), (u"key11", u"{{tree1.tree2.key6}}"), + (u"key12", u"{{PY:version}}"), + (u"key13", u"{{tree1.key3}}__{{PY:version}}"), ]))])
