[Python-checkins] benchmarks: Use re.purge() to clear the re cache.
brett.cannon
python-checkins at python.org
Fri Oct 30 17:25:23 EDT 2015
https://hg.python.org/benchmarks/rev/0da7b44c2ea3
changeset: 230:0da7b44c2ea3
user: Brett Cannon <brett at python.org>
date: Fri Oct 30 14:25:18 2015 -0700
summary:
Use re.purge() to clear the re cache.
Closes issue #25426.
files:
performance/bm_regex_compile.py | 11 +----------
1 files changed, 1 insertions(+), 10 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
@@ -53,16 +53,7 @@
def test_regex_compile(count, timer):
- try:
- clear_cache = re._cache.clear
- except AttributeError:
- 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
-
+ re.purge()
regexes = capture_regexes()
times = []
--
Repository URL: https://hg.python.org/benchmarks
More information about the Python-checkins
mailing list