summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-10-05 08:19:26 (GMT)
committerGitHub <noreply@github.com>2017-10-05 08:19:26 (GMT)
commitc1c47c166b1012d34f2c6e111ee9ccb5c4d12de7 (patch)
tree8abd62a2c34b8c1d6c9aa37b0ab47e216162edcf /Doc
parentaf810b35b494ef1d255d4bf340b92a9dad446995 (diff)
downloadcpython-c1c47c166b1012d34f2c6e111ee9ccb5c4d12de7.zip
cpython-c1c47c166b1012d34f2c6e111ee9ccb5c4d12de7.tar.gz
cpython-c1c47c166b1012d34f2c6e111ee9ccb5c4d12de7.tar.bz2
bpo-31671: re: Convert RegexFlag to int before compile (GH-3862)
sre_compile does bit test (e.g. `flags & SRE_FLAG_IGNORECASE`) in loop. `IntFlag.__and__` and `IntFlag.__new__` made it slower. So this commit convert it to normal int before passing flags to `sre_compile()`.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/whatsnew/3.7.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
index 845ed64..19b766f 100644
--- a/Doc/whatsnew/3.7.rst
+++ b/Doc/whatsnew/3.7.rst
@@ -326,6 +326,11 @@ Optimizations
expressions <re>`. Searching some patterns can now be up to 20 times faster.
(Contributed by Serhiy Storchaka in :issue:`30285`.)
+* :func:`re.compile` now converts ``flags`` parameter to int object if
+ it is ``RegexFlag``. It is now as fast as Python 3.5, and faster than
+ Python 3.6 about 10% depending on the pattern.
+ (Contributed by INADA Naoki in :issue:`31671`.)
+
* :meth:`selectors.EpollSelector.modify`, :meth:`selectors.PollSelector.modify`
and :meth:`selectors.DevpollSelector.modify` may be around 10% faster under
heavy loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)