In profiling sphinx-build on a project of mine, I noticed a lot of time was spent in re.compile in docutils/statemachine.py. This patch makes it so that only about 20 re.compile calls are made during my whole doc build instead of (tens or hundreds of?) thousands.
It cuts my total sphinx-build doc build time from 4m56s to 4m25s. Not phenomenal, but 5-10% overall speedup seems worth it for a simple change.
I usually use git and GitHub for changesets, apologies in advance if my patch is malformed. I just did git diff > speedup.patch.
patch format is fine .
inside docutils
patch -p1 < speedup.patchthanks