Just parsing constructor docstrings takes 4.6% of time (based on a --make-intersphinx run which skip html generation, the step that takes most of the time) because of this line in docutils which is always reached from the constructor docstrings parsing.
I suspect this is because we're generating a link tag with a label with parenthesis like `Class(arg2, arg2) <module.Class.__init__>`; This label probably makes docutils go in some cold/unoptimized branches which are very time consuming...
Just parsing constructor docstrings takes 4.6% of time (based on a --make-intersphinx run which skip html generation, the step that takes most of the time) because of this line in docutils which is always reached from the constructor docstrings parsing. I suspect this is because we're generating a link tag with a label with parenthesis like
`Class(arg2, arg2) <module.Class.__init__>`
; This label probably makes docutils go in some cold/unoptimized branches which are very time consuming...https://github.com/twisted/pydoctor/blob/936db9373becb1e3d2ca7a94601fad4c76faf7da/pydoctor/epydoc2stan.py#L1150
The solution would be to avoid parsing restructuredtext programmatically, instead construct the document node manually.