[issue31671] IntFlag makes re.compile slower

INADA Naoki report at bugs.python.org
Wed Oct 4 19:12:30 EDT 2017


INADA Naoki <songofacandy at gmail.com> added the comment:

> IntFlag.__and__ does not create a new instance every time -- all new instances are cached in the IntFlag machinery (so RegexFlag(7) is only created once).

I'm sorry, I misunderstood.
But while new instance is not created each time, 4 Python method calls
(e,g.  IntFlag.__and__() -> IntFlag.__new__() -> IntFlag._missing_() -> IntFlag._create_pseudo_member_()) are much slower than int & int.

> If all the RegexFlag combinations are created before the regex compile benchmark do we still see a speed-up?

I believe that's what Victor benchmarked.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31671>
_______________________________________


More information about the Python-bugs-list mailing list