fix_refs is by far the slowest part of this
#187
Closed
Labels
Comments
pawamoy
pushed a commit
that referenced
this issue
Dec 6, 2020
Define a "transport representation" for autorefs:
<span data-mkdocstrings-identifier="SomeIdentifier">SomeHTML</span>
First a native Markdown extension translates from the usual `[SomeMarkdown][SomeIdentifier]` to the above, and then the post-process replacement mechanism (which is kept in the same place as before) doesn't need to be so careful and complicated, it just indiscriminately replaces such exact strings.
This is a very big boost in performance and I think is more future-proof.
Other mkdocstrings handlers are also free to use this mechanism: define whatever syntax for autorefs that they need and then insert this exact HTML themselves, for the postprocessing to pick up later. It used to be possible to insert the square-brackets Markdown before, but that was very fragile.
Issue #187: #187
PR #188: #188
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's quite sad that I'm running into real slowness when trying to apply mkdocstrings.
Anyway, I ran some profiling on a site with a lot of doc objects, and found that over half of the time (of the whole site build) is spent in
fix_refs. It's probably not a surprise that it's slow, but it's really that slow. So if anyone's looking to improve performance, look at this first.The text was updated successfully, but these errors were encountered: