blob: 20a205e8cda1f0aa10732558b469ddaa3a4a5a8a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
set -e
measure() {
python -m timeit \
-s 'import logging, tracing' \
-s 'logging.basicConfig(filename="/dev/null")' \
-s "$1" \
-s '
class Foo(object):
def foo(self):
tracing.trace("%s", "bar")
f = Foo()
' \
'f.foo()'
}
echo tracing: Without patterns
measure "pass"
echo tracing: With unmatching pattern
measure 'tracing.trace_add_pattern("yikes")'
echo tracing: With matching pattern
measure 'tracing.trace_add_pattern("timeit-src")'
measure_logging() {
python -m timeit \
-s 'import logging' \
-s 'logging.basicConfig(filename="/dev/null")' \
-s "$1" \
-s '
class Foo(object):
def foo(self):
logging.debug("%s", "bar")
f = Foo()
' \
'f.foo()'
}
echo logging: With debug messages
measure_logging pass
echo logging: Without debug messages
measure_logging \
'logging.basicConfig(filename="/dev/null", level=logging.INFO)'
|