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@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.bjarna...@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 <jdha...@gmail.com> wrote: > > On Wed, Apr 23, 2014 at 6:14 AM, Pawel Jasinski > > <pawel.jasin...@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@python.org > > https://mail.python.org/mailman/listinfo/ironpython-users >
_______________________________________________ Ironpython-users mailing list Ironpython-users@python.org https://mail.python.org/mailman/listinfo/ironpython-users