Open ChrisPenner opened 1 month ago
Q: Main issue is that docs are slow to render, but why?
Consider caching failed runs (e.g. todo
); possibly key the cache on the set of builtins?
Maybe slow to evaluate docs due to lots of postgres traffic?
Next step: Identify a slow doc (e.g. TV/README) and profile it to figure out why it's actually slow. Seems like it's loading all the code that's mentioned, not just code that needs to be executed; hopefully we can avoid that.
Docs are parsed into Unison terms one-word-at-a-time, which means a doc with 2000 words has at LEAST 2000 function calls 🙃 .
Even worse, the way it's resolved, it doesn't even resolve to a
Doc
literal, it resolves to a tree full ofdocWord
calls:Which is a function, which must be evaluated on a text argument, which then actually calls the constructor, which returns the Doc.
Some ways to clean this up would be to: