On Tue, 3 Oct 2017 10:21:55 -0400 Barry Warsaw <barry at python.org> wrote: > On Oct 3, 2017, at 01:41, Serhiy Storchaka <storchaka at gmail.com> wrote: > > > > 03.10.17 06:29, INADA Naoki пише: > >> More optimization can be done with implementing sre_parse and sre_compile in C. > >> But I have no time for it in this year. > > > > And please don't do this! This would make maintaining the re module hard. The performance of the compiler is less important than correctness and performance of matching and searching. > > What if the compiler could recognize constant arguments to re.compile() and do the regex compilation at that point? You’d need a way to represent the precompiled regex in the bytecode, and it would technically be a semantic change since regex problems would be discovered at compilation time instead of runtime - but that might be a good thing. You could also make that an optimization flag for opt-in, or a flag to allow opt out. We need a regex literal! With bytes, formatted, and bytes formatted variants. Regards Antoine.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4