Mercurial > hgrepos > Python > libs > ConfigMix
annotate tests/_perf_config.py @ 542:f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
This is currently for Python 3.5+.
It is tested with Python 3.7 and Python3.8 (FreeBSD 12.2 amd64, LLVM 10.0.1).
A build for the stable API ("abi3") fails because PyUnicode_New() is currently
not in the stable API.
Also includes are extended tests for unquote() and pathstr2path().
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 31 Dec 2021 21:24:16 +0100 |
| parents | 9546d38cd3f8 |
| children | 491413368c7c |
| 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: |
|
f71d34dda19f
Add an optional C-implementation for configmix.config.unquote and configmix.config.pathstr2path.
Franz Glasner <fzglas.hg@dom66.de>
parents:
539
diff
changeset
|
19 from configmix.config import fast_unquote, 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
|
20 except ImportError: |
|
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 fast_unquote = fast_pathstr2path = None |
|
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 |
|
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
|
27 from configmix.config import _HIER_SEPARATOR, quote, py_pathstr2path, py_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
|
28 try: |
|
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 from configmix.config import fast_unquote, 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
|
30 except ImportError: |
|
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 fast_unquote = fast_pathstr2path = None |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
32 |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
33 TESTDATADIR = os.path.join( |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
34 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
|
35 "..", |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
36 "tests", |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
37 "data") |
|
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 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
|
40 |
|
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
|
41 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
|
42 s1 = u"abc.def.hij" |
|
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 |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
44 """ |
|
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
diff
changeset
|
45 |
|
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 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
|
48 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
|
49 |
|
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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 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
|
55 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
|
56 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
|
57 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
|
58 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)) |
|
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/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)) |
|
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("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
|
61 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
|
62 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
|
63 print("fast-pathstr2path/non-empty: %.4f" % timeit.timeit('a = fast_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
|
64 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
|
65 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
|
66 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)) |
|
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("="*50) |
|
505
9e5fec21e2fb
Measure quote/unquote performance
Franz Glasner <fzglas.hg@dom66.de>
parents:
501
diff
changeset
|
68 |
|
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
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 print("-"*50) |
|
496
36ab39e3de53
A script to measure some basic performance characteristics of configmix.
Franz Glasner <fzglas.hg@dom66.de>
parents:
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 "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
|
77 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
|
78 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
|
79 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
|
80 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
|
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 |
|
533
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
83 if all or "expand-string-one" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
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-noncached" in opts: |
|
e43db776f80a
Perf script: "once" -> "one"
Franz Glasner <fzglas.hg@dom66.de>
parents:
532
diff
changeset
|
91 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
|
92 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
|
93 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
|
94 print("expand-string-one-noncached: %.4f" % timeit.timeit('cfg.getvar_s(u"tree1.tree2.key12")', setup=setup, number=num)) |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
95 print("-"*50) |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
96 |
|
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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 print("-"*50) |
|
501
1c83389fb8dd
Another timing for interpolating a single string completely
Franz Glasner <fzglas.hg@dom66.de>
parents:
498
diff
changeset
|
103 |
|
532
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
104 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
|
105 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
|
106 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
|
107 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
|
108 print("expand-string-many-noncached: %.4f" % timeit.timeit('cfg.getvar_s(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
|
109 print("-"*50) |
|
c2947ac74b0c
Add timing for non-cached interpolations: using the PY: namespace
Franz Glasner <fzglas.hg@dom66.de>
parents:
514
diff
changeset
|
110 |
|
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
|
111 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
|
112 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
|
113 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
|
114 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
|
115 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
|
116 print("-"*50) |
