Raymond Hettinger  committed 4ab9190

Set cache sizes to a power-of-two

  • Participants
  • Parent commits 0f65bf6
  • Branches 3.3

Comments (0)

Files changed (2)

File Lib/

     pat = os.path.normcase(pat)
     return fnmatchcase(name, pat)
-@functools.lru_cache(maxsize=250, typed=True)
+@functools.lru_cache(maxsize=256, typed=True)
 def _compile_pattern(pat):
     if isinstance(pat, bytes):
         pat_str = str(pat, 'ISO-8859-1')
 _pattern_type = type(sre_compile.compile("", 0))
-@functools.lru_cache(maxsize=500, typed=True)
+@functools.lru_cache(maxsize=512, typed=True)
 def _compile(pattern, flags):
     # internal: compile pattern
     if isinstance(pattern, _pattern_type):
         raise TypeError("first argument must be string or compiled pattern")
     return sre_compile.compile(pattern, flags)
 def _compile_repl(repl, pattern):
     # internal: compile replacement pattern
     return sre_parse.parse_template(repl, pattern)