Mercurial > hgrepos > Python > libs > ConfigMix
annotate tests/_perf_config.py @ 654:0d6673d06c2c
Add support for using "tomllib" (in Python's stdlib since 3.11) and "tomli" TOML packages.
They are preferred if they are found to be installed.
But note that the declared dependency for the "toml" extra nevertheless
is the "toml" package. Because it is available for all supported Python
versions.
So use Python 3.11+ or install "tomli" manually if you want to use the
alternate packages.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Thu, 19 May 2022 22:10:59 +0200 |
| parents | 75ecbe07abff |
| children |
| rev | line source |
|---|---|
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
2 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
3 from __future__ import print_function |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
4 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
5 import os |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
6 import sys |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
7 import timeit |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
8 |
|
619
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
550
diff
changeset
|
9 from _test_context import TESTDATADIR |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
11 |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
12 opts = sys.argv[1:] |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
13 all = not opts or "all" in opts |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
14 |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
15 try: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
16 from configmix.config import fast_unquote, fast_quote, \ |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
17 fast_pathstr2path, _fast_split_ns |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
18 except ImportError: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
19 fast_unquote = fast_quote = fast_pathstr2path = _fast_split_ns = None |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
20 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
21 setup = """ |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
22 import os |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
23 |
|
619
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
550
diff
changeset
|
24 from _test_context import TESTDATADIR |
|
75ecbe07abff
Introduct a test context to more easily switch between some unittest configurations
Franz Glasner <f.glasner@feldmann-mg.com>
parents:
550
diff
changeset
|
25 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 import configmix |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
27 from configmix.config import _HIER_SEPARATOR, \ |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
28 py_quote, py_unquote, py_pathstr2path, \ |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
29 _py_split_ns |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
30 try: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
31 from configmix.config import fast_unquote, fast_quote, fast_pathstr2path, _fast_split_ns |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
32 except ImportError: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
33 fast_unquote = fast_quote = fast_pathstr2path = _fast_split_ns = None |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
35 cfg = configmix.load(os.path.join(TESTDATADIR, "conf_perf.py")) |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 |
|
539
9546d38cd3f8
Refactor: the parsing of the quoted and dot-separated path string is put into a function that handles also empty inputs properly
Franz Glasner <fzglas.hg@dom66.de>
parents:
533
diff
changeset
|
37 se = u"" |
|
9546d38cd3f8
Refactor: the parsing of the quoted and dot-separated path string is put into a function that handles also empty inputs properly
Franz Glasner <fzglas.hg@dom66.de>
parents:
533
diff
changeset
|
38 s1 = u"abc.def.hij" |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
39 ns_s1 = u"PY:abc.def.hij" |
|
539
9546d38cd3f8
Refactor: the parsing of the quoted and dot-separated path string is put into a function that handles also empty inputs properly
Franz Glasner <fzglas.hg@dom66.de>
parents:
533
diff
changeset
|
40 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
41 """ |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
42 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
43 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 num = 1000000 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
45 num_quote = 1 * num |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
46 |
|
539
9546d38cd3f8
Refactor: the parsing of the quoted and dot-separated path string is put into a function that handles also empty inputs properly
Franz Glasner <fzglas.hg@dom66.de>
parents:
533
diff
changeset
|
47 if all or "quote" in opts or "unquote" in opts or "path" in opts: |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
48 print("unquote/nothing/split: %.4f" % timeit.timeit('a = [py_unquote(vp) for vp in u"abc.def.hij".split(_HIER_SEPARATOR)]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
49 print("unquote/yes/split: %.4f" % timeit.timeit('a = [py_unquote(vp) for vp in u"ab%x20.def.h%x2ej".split(_HIER_SEPARATOR)]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
50 print("unquote/nothing/no-split: %.4f" % timeit.timeit('a = [py_unquote(vp) for vp in (u"abc," u"def", u"hij")]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
51 print("unquote/yes/no-split: %.4f" % timeit.timeit('a = [py_unquote(vp) for vp in (u"ab%x20", u"def", u"h%x2ej")]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
52 if fast_unquote: |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
53 print("fast-unquote/nothing/split: %.4f" % timeit.timeit('a = [fast_unquote(vp) for vp in u"abc.def.hij".split(_HIER_SEPARATOR)]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
54 print("fast-unquote/yes/split: %.4f" % timeit.timeit('a = [fast_unquote(vp) for vp in u"ab%x20.def.h%x2ej".split(_HIER_SEPARATOR)]', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
55 print("fast-unquote/nothing/no-split: %.4f" % timeit.timeit('a = [fast_unquote(vp) for vp in (u"abc," u"def", u"hij")]', setup=setup, number=num_quote)) |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
56 print("fast-unquote/yes/no-split: %.4f" % timeit.timeit('a = [fast_unquote(vp) for vp in (u"ab%x20", u"def", u"h%x2ej")]', setup=setup, number=num_quote)) |
|
542
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
57 print("pathstr2path/non-empty: %.4f" % timeit.timeit('a = py_pathstr2path(s1)', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
58 print("pathstr2path/empty: %.4f" % timeit.timeit('a = py_pathstr2path(se)', setup=setup, number=num_quote)) |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
59 if fast_pathstr2path: |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
60 print("fast-pathstr2path/non-empty: %.4f" % timeit.timeit('a = fast_pathstr2path(s1)', setup=setup, number=num_quote)) |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
61 print("fast-pathstr2path/empty: %.4f" % timeit.timeit('a = fast_pathstr2path(se)', setup=setup, number=num_quote)) |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
62 print("quote/nothing: %.4f" % timeit.timeit('a = [py_quote(vp) for vp in (u"abc", u"def", u"hij")]', setup=setup, number=num_quote)) |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
63 print("quote/yes: %.4f" % timeit.timeit('a = [py_quote(vp) for vp in (u"ab:c", u"def", u"h.ij")]', setup=setup, number=num_quote)) |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
64 if fast_quote: |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
65 print("fast-quote/nothing: %.4f" % timeit.timeit('a = [fast_quote(vp) for vp in (u"abc", u"def", u"hij")]', setup=setup, number=num_quote)) |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
66 print("fast-quote/yes: %.4f" % timeit.timeit('a = [fast_quote(vp) for vp in (u"ab:c", u"def", u"h.ij")]', setup=setup, number=num_quote)) |
|
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
67 |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
68 print("split-ns/no-ns: %.4f" % timeit.timeit('a = _py_split_ns(s1)', setup=setup, number=num_quote)) |
|
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
69 print("split-ns/ns: %.4f" % timeit.timeit('a = _py_split_ns(ns_s1)', setup=setup, number=num_quote)) |
|
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
70 if _fast_split_ns: |
|
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
71 print("fast-split-ns/no-ns: %.4f" % timeit.timeit('a = _fast_split_ns(s1)', setup=setup, number=num_quote)) |
|
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
72 print("fast-split-ns/ns: %.4f" % timeit.timeit('a = _fast_split_ns(ns_s1)', setup=setup, number=num_quote)) |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
73 print("="*50) |
|
505
9e5fec21e2fb
Measure quote/unquote performance
Franz Glasner <fzglas.hg@dom66.de>
parents:
501
diff
changeset
|
74 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
75 if all or "default" in opts or "non-existing" in opts: |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
76 print("default: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"yyy", default=None)', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
77 print("default: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"yyy", default=None)', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
78 print("default: %.4f" % timeit.timeit('cfg.getvar(u"tree1.yyy", default=None)', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
79 print("default: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.yyy", default=None)', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
80 print("-"*50) |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
81 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
82 if all or "simple-string" in opts: |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
83 print("simple-string: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key4")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
84 print("simple-string: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key4")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
85 print("simple-string: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key4")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
86 print("simple-string: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key4")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
87 print("-"*50) |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
88 |
|
533
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
89 if all or "expand-string-one" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
90 print("expand-string-one: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key11")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
91 print("expand-string-one: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key11")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
92 print("expand-string-one: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key11")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
93 print("expand-string-one: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key11")', setup=setup, number=num)) |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
94 print("-"*50) |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
95 |
|
533
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
96 if all or "expand-string-one-noncached" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
97 print("expand-string-one-noncached: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key12")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
98 print("expand-string-one-noncached: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key12")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
99 print("expand-string-one-noncached: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key12")', setup=setup, number=num)) |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
100 print("expand-string-one-noncached: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key12")', setup=setup, number=num)) |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
101 print("-"*50) |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
102 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
103 if all or "expand-string-many" in opts: |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
104 print("expand-string-many: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key10")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
105 print("expand-string-many: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key10")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
106 print("expand-string-many: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key10")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
107 print("expand-string-many: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key10")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
108 print("-"*50) |
|
501
1c83389fb8dd
Another timing for interpolating a single string completely
Franz Glasner <fzglas.hg@dom66.de>
parents:
498
diff
changeset
|
109 |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
110 if all or "expand-string-many-noncached" in opts: |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
111 print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", u"key13")', setup=setup, number=num)) |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
112 print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", u"key13")', setup=setup, number=num)) |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
113 print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key13")', setup=setup, number=num)) |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
114 print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key13")', setup=setup, number=num)) |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
115 print("-"*50) |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
116 |
|
514
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
117 if all or "expand-list" in opts: |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
118 print("expand-list: %.4f" % timeit.timeit('cfg.getvarl(u"tree1", u"tree2", "key8")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
119 print("expand-list: %.4f" % timeit.timeit('cfg.getvarl_s(u"tree1", u"tree2", "key8")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
120 print("expand-list: %.4f" % timeit.timeit('cfg.getvar(u"tree1.tree2.key8")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
121 print("expand-list: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key8")', setup=setup, number=num)) |
|
d803321d927b
Move convenient output from the performance script and command line arguments to select all or some performance numbers
Franz Glasner <fzglas.hg@dom66.de>
parents:
508
diff
changeset
|
122 print("-"*50) |
