= Group all SQL queries together
And do 5 big queries instead of hundreds of smaller ones.
For example, a README.ciro document that references another document saying:
``
The \x[speed-of-light] is fast.
``
needs to fetch "speed-of-light" from the ID database (previously populated e.g. by preparsing light.ciro:
``
= Light
== Speed of light
``
to decide that it should display as "Speed of light" (the title rather than the ID).
Previously, I was doing a separate fetch for each `\x[]` as they were needed, leading to hundreds of them at different times.
Now I refactored things so that I do very few database queries, but large ones that fetch everything during parsing. And then at render time they are all ready in cache.
This will be fundamental for the live preview on the browser, where the roundtrip to server would make it impossible
Back to article page