annotate tests/_perf_config.py @ 543:491413368c7c

Added also a fast C-implementation of configmix.config._split_ns
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 01 Jan 2022 18:01:32 +0100
parents f71d34dda19f
children 79db28e879f8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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:
543
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
19 from configmix.config import fast_unquote, 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
20 except ImportError:
543
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
21 fast_unquote = 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
22
496
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
23 setup = """
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
24 import os
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
25
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
26 import configmix
543
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
27 from configmix.config import _HIER_SEPARATOR, quote, py_pathstr2path, \
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
28 py_unquote, _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
29 try:
543
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
30 from configmix.config import fast_unquote, 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
31 except ImportError:
543
491413368c7c Added also a fast C-implementation of configmix.config._split_ns
Franz Glasner <fzglas.hg@dom66.de>
parents: 542
diff changeset
32 fast_unquote = 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
33
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
34 TESTDATADIR = os.path.join(
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
35 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
36 "..",
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
37 "tests",
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
38 "data")
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
39
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
40 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
41
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
42 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
43 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
44 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
45
496
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
46 """
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
47
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 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
50 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
51
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
52 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
53 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
54 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
55 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
56 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
57 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
58 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
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 print("fast-pathstr2path/empty: %.4f" % timeit.timeit('a = fast_pathstr2path(se)', 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
67 print("quote/nothing: %.4f" % timeit.timeit('a = [quote(vp) for vp in (u"abc", u"def", u"hij")]', setup=setup, number=num_quote))
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
68 print("quote/yes: %.4f" % timeit.timeit('a = [quote(vp) for vp in (u"ab:c", u"def", u"h.ij")]', 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
69 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
70 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
71 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
72 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
73 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
74 print("="*50)
505
9e5fec21e2fb Measure quote/unquote performance
Franz Glasner <fzglas.hg@dom66.de>
parents: 501
diff changeset
75
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
76 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
77 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
78 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
79 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
80 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
81 print("-"*50)
496
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
82
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
83 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
84 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
85 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
86 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
87 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
88 print("-"*50)
496
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
89
533
e43db776f80a Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents: 532
diff changeset
90 if all or "expand-string-one" in opts:
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(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.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
93 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
94 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
95 print("-"*50)
496
36ab39e3de53 A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff changeset
96
533
e43db776f80a Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents: 532
diff changeset
97 if all or "expand-string-one-noncached" in opts:
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(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.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
100 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
101 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
102 print("-"*50)
532
c2947ac74b0c Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents: 514
diff changeset
103
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
104 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
105 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
106 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
107 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
108 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
109 print("-"*50)
501
1c83389fb8dd Another timing for interpolating a single string completely
Franz Glasner <fzglas.hg@dom66.de>
parents: 498
diff changeset
110
532
c2947ac74b0c Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents: 514
diff changeset
111 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
112 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
113 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
114 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
115 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
116 print("-"*50)
532
c2947ac74b0c Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents: 514
diff changeset
117
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
118 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
119 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
120 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
121 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
122 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
123 print("-"*50)