[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Roundup Robot
Roundup Robot added the comment: New changeset 88110cfbf4dc by Raymond Hettinger in branch '3.6': Issue #28193: Use lru_cache in the re module. https://hg.python.org/cpython/rev/88110cfbf4dc -- nosy: +python-dev ___ Python tracker

[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: I think I'll just take the low hanging fruit in _compile_repl and call it a day. -- ___ Python tracker ___ __

[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, raising an exception with a result as a payload is one option. Other option is to check a result. Something like: def _compile_is_valid(value): p, loc = value return loc is None or loc == _locale.setlocale(_locale.LC_CTYPE) def _compile_cache_if

[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: Yes, I saw that. If a function could raise a NoCache exception, re._compile() could take advantage of it. But I don't feel good about going down that path (adding coupling between the caching decorator and the cached function). It would be better to kee

[issue28193] Consider using lru_cache for the re.py caches

2016-09-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: lru_cache can be used for re._compile() if add the ability to bypass the cache and to validate cached value. -- ___ Python tracker ___ __

[issue28193] Consider using lru_cache for the re.py caches

2016-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Added comments on Rietveld. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue28193] Consider using lru_cache for the re.py caches

2016-09-17 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- keywords: +patch Added file: http://bugs.python.org/file44731/re_repl_cache.diff ___ Python tracker ___

[issue28193] Consider using lru_cache for the re.py caches

2016-09-17 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Since that time the logic of re._compile() was changed. Now it can't just be wrapped with lru_cache(). -- ___ Python tracker ___

[issue28193] Consider using lru_cache for the re.py caches

2016-09-17 Thread Raymond Hettinger
New submission from Raymond Hettinger: The last time we applied the LRU cache to the re.py module, the overhead of the pure python version resulted in a net performance decrease. But now we have a highly performance C version and should consider reinstating the code. -- assignee: serh