[Ironpython-users] running asciidoc

Pawel Jasinski pawel.jasinski at gmail.com
Wed Apr 23 10:31:22 CEST 2014


Sometimes documentation is not clear. The simple test confirms that cpython
re.compile caches results.
I can not imaging that asciidoc could provide reasonable performance if it
was not true. It does call multiple time compile with the same pattern.

rejap at eb60:~/Downloads$ python
Python 2.7.5+ (default, Feb 27 2014, 19:37:08)
[GCC 4.8.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.compile('a')
<_sre.SRE_Pattern object at 0x160b0b8>
>>> re.compile('a')
<_sre.SRE_Pattern object at 0x160b0b8>
>>> re.compile('a')==re.compile('a')
True

--pawel



On Wed, Apr 23, 2014 at 9:51 AM, Olof Bjarnason <olof.bjarnason at gmail.com>wrote:

> Official 2.7 documentation *hints* that re.compile does not cache
> re.compile results (since some methods of module re actually are
> caching result from re.compile):
>
> https://docs.python.org/2/library/re.html#re.compile
>
> On 23 April 2014 08:34, Jeff Hardy <jdhardy at gmail.com> wrote:
> > On Wed, Apr 23, 2014 at 6:14 AM, Pawel Jasinski
> > <pawel.jasinski at gmail.com> wrote:
> >> asciidoc calls frequently re.compile.
> >> In case of cpython re.compile uses cache, where ironpython performs
> compile
> >> unconditionally.
> >> https://ironpython.codeplex.com/workitem/35146
> >
> > Why would it repeatedly call compile? The point of compile is that it
> > should only be called once and then the result re-used.
> >
> > - Jeff
> > _______________________________________________
> > Ironpython-users mailing list
> > Ironpython-users at python.org
> > https://mail.python.org/mailman/listinfo/ironpython-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140423/546074b9/attachment.html>


More information about the Ironpython-users mailing list