Mercurial > hgrepos > Python > libs > ConfigMix
annotate tests/_perf_config.py @ 605:776dc94b4ef7
Comment
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Tue, 11 Jan 2022 09:24:08 +0100 |
| parents | 79db28e879f8 |
| children | 75ecbe07abff |
| 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 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
9 sys.path.insert( |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
10 0, |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
11 os.path.abspath( |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
12 os.path.normpath(os.path.join(os.path.dirname(__file__), "..")))) |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
13 |
|
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
|
14 |
|
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
|
15 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
|
16 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
|
17 |
|
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 try: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
19 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
|
20 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
|
21 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
|
22 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
|
23 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
24 setup = """ |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
25 import os |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
26 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 _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
|
31 try: |
|
550
79db28e879f8
Provide a C-implementation of configmix.config.quote() also: fast_quote
Franz Glasner <fzglas.hg@dom66.de>
parents:
543
diff
changeset
|
32 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
|
33 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
|
34 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
|
35 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 TESTDATADIR = os.path.join( |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 os.path.abspath(os.path.dirname(configmix.__file__)), |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
38 "..", |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
39 "tests", |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
40 "data") |
|
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 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
|
43 |
|
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
|
44 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
|
45 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
|
46 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
|
47 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
48 """ |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
49 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
50 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
51 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
|
52 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
|
53 |
|
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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 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
|
63 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
|
64 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
|
65 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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 |
|
543
491413368c7c
Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents:
542
diff
changeset
|
75 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
|
76 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
|
77 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
|
78 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
|
79 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
|
80 print("="*50) |
|
505
9e5fec21e2fb
Measure quote/unquote performance
Franz Glasner <fzglas.hg@dom66.de>
parents:
501
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 "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
|
83 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
|
84 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
|
85 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
|
86 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
|
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 |
|
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
|
89 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
|
90 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
|
91 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
|
92 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
|
93 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
|
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" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 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
|
101 print("-"*50) |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
102 |
|
533
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
103 if all or "expand-string-one-noncached" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 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
|
108 print("-"*50) |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
109 |
|
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
|
110 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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 print("-"*50) |
|
501
1c83389fb8dd
Another timing for interpolating a single string completely
Franz Glasner <fzglas.hg@dom66.de>
parents:
498
diff
changeset
|
116 |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 print("-"*50) |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
123 |
|
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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 print("-"*50) |
