[docutils:patches] #206 Improve SmartQuote performance

"Günter Milde" via Docutils-develop <[email protected]>
Newsgroups gmane.text.docutils.devel
Message-ID </p/docutils/patches/206/245f6b8e03c44a95d581da39b8f177499afcaa7f.patches@docutils.p.sourceforge.net>
- **status**: open --> open-fixed
- **Comment**:

Applied in [r9479]. More optimizations in [r9480] and  [r9481]



---

**[patches:#206] Improve SmartQuote performance**

**Status:** open-fixed
**Group:** None
**Created:** Wed Aug 16, 2023 04:37 PM UTC by Chris Sewell
**Last Updated:** Sun Nov 19, 2023 09:32 PM UTC
**Owner:** nobody
**Attachments:**

- [0001-Pre-compile-smartquote-regexes.patch](https://sourceforge.net/p/docutils/patches/206/attachment/0001-Pre-compile-smartquote-regexes.patch) (8.3 kB; application/octet-stream)
- [sphinx-build-after.svg](https://sourceforge.net/p/docutils/patches/206/attachment/sphinx-build-after.svg) (199.1 kB; image/svg+xml)
- [sphinx-build-before.svg](https://sourceforge.net/p/docutils/patches/206/attachment/sphinx-build-before.svg) (282.1 kB; image/svg+xml)


Performing a representative sphinx-build (10 x docutils/docs/ref/rst/restructuredtext.txt, dummy builder), and analysing with py-spy, you can see from the attached flamegraph that the smartquote transform accouts for over 22% of the build time!

This PR attempts to improve that situation (at least down to 18%) by caching regex compilation 


---

Sent from sourceforge.net because [email protected] is subscribed to https://sourceforge.net/p/docutils/patches/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/patches/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.