[Python-checkins] benchmarks: Fix the regex_compile benchmark under 3.3
antoine.pitrou
python-checkins at python.org
Sat Oct 22 03:34:49 CEST 2011
http://hg.python.org/benchmarks/rev/9f9ba3f248d5
changeset: 150:9f9ba3f248d5
user: Antoine Pitrou <solipsis at pitrou.net>
date: Sat Oct 22 03:30:46 2011 +0200
summary:
Fix the regex_compile benchmark under 3.3
files:
performance/bm_regex_compile.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/performance/bm_regex_compile.py b/performance/bm_regex_compile.py
--- a/performance/bm_regex_compile.py
+++ b/performance/bm_regex_compile.py
@@ -56,8 +56,12 @@
try:
clear_cache = re._cache.clear
except AttributeError:
- # Python 3.2+: re uses functools.lru_cache()
- clear_cache = re._compile_typed.cache_clear
+ try:
+ # Python 3.2: re._compile_typed() uses functools.lru_cache()
+ clear_cache = re._compile_typed.cache_clear
+ except AttributeError:
+ # Python 3.3: re._compile() uses functools.lru_cache()
+ clear_cache = re._compile.cache_clear
regexes = capture_regexes()
times = []
--
Repository URL: http://hg.python.org/benchmarks
More information about the Python-checkins
mailing list