Serhiy Storchaka added the comment: I'm surprised, but perhaps performance benefit actually exists (check this on other computers).
### regex_effbot ### Min: 0.333525 -> 0.325349: 1.03x faster Avg: 0.342451 -> 0.331665: 1.03x faster Significant (t=12.13) Stddev: 0.00606 -> 0.00651: 1.0738x larger However the main benefit is that non-cached constructor (re.compile is a constructor of regular expression object) is expected to be non-cached, while other module level functions can be cached. See for example struct.Struct. We can cache non-cached constructor explicitly (as in fnmatch), but when a constructor already cached, adding new cache can only add overhead. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue17441> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com