Closed baryluk closed 2 years ago
You can't use it multi-threaded: we change Renderer
state so it'll be buggy if done from multiple threads. -race
flag typically exposes multi-threading issues.
You can't re-use html renderer because it carries per-markdown state (e.g. headingIDs
).
You could add a Reset()
method but I doubt that would be a significant perf win as Renderer
state is small and therefore fast to allocate.
You are right @kjk - headingIDs
makes it a no go. I didn't notice it before.
Adding Reset()
is not a good idea either.
Hi,
I am wondering, for a provided
html
renderer specifically.Two questions:
html renderer appears to just carry data that is initialized on creation only, then its content is not modified, thus my claims 1 and 2 above.
But, these are implicit assumptions. I really would like for the both to be true, so the creation of the renderer can be moved out of the loop when processing big numbers of markdown inputs. (Parser still needs to be created from scratch obviously).