summaryrefslogtreecommitdiff
path: root/speed-test
diff options
context:
space:
mode:
authorLars Wirzenius <liw@xander>2011-02-04 22:21:22 +0200
committerLars Wirzenius <liw@xander>2011-02-04 22:21:22 +0200
commit9ec4c1dab031f14041dd363428100136f7079fa3 (patch)
tree9d682df5eb9a5be7068b874810b2fe9a601579b8 /speed-test
parent67aca5f5bc86673a59ccbadc5ec3c3e4984b52a0 (diff)
parent7c08f99a8f0e8d12afb8adb6966f4bb3262c8697 (diff)
downloadpython-tracing-9ec4c1dab031f14041dd363428100136f7079fa3.tar.gz
Merge speed test and optimizations.
Diffstat (limited to 'speed-test')
-rwxr-xr-xspeed-test27
1 files changed, 27 insertions, 0 deletions
diff --git a/speed-test b/speed-test
new file mode 100755
index 0000000..76e6b9a
--- /dev/null
+++ b/speed-test
@@ -0,0 +1,27 @@
+#!/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 Without patterns
+measure "pass"
+
+echo With unmatching pattern
+measure 'tracing.trace_add_pattern("yikes")'
+
+echo With matching pattern
+measure 'tracing.trace_add_pattern("timeit-src")'