Banzai optimization ideas
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
While working on Banzai optimization tasks I discovered several targets in rendering that can be improved
source link)
1. EmojiFilter (It fetches all text nodes, converts them to HTML and replaces found :emoji: strings with images.
Ideas
- Try to use
node.text
instead ofnode.to_html
because it is much faster. However, we have to ensure that this change does not break anything.
source link)
2. Regex search in reference cache (We scan html document with regex for different references (issues, merge requests, ...). For large documents (for example, https://gitlab.com/gitlab-org/gitlab/-/blob/master/CHANGELOG.md) the regex search takes significant time.
Ideas
- Try to extract all references at once (currently we call regex for each ReferenceFilter in the list)
- Find an alternative to regex search
- Use a faster regex implementation
source link)
3. Optimize queries to verify reference objects (We use several WHERE IN (...)
queries for fetch merge requests for example. If we have many merge request ids the queries becomes slow. As an alternative we can use INNER JOIN (VALUES (...))
trick.
Implementations
Feel free to update the description with other examples/ideas.