Skip to content

Cache highlighted content for diff note files

Currently we do cache the note raw diff content for discussions on note_diff_files table but we don't cache the highlighted content. I believe there's room to greatly improve the loading time of the MR discussions by doing so.

Profiling a MR with lots of diff comments:

Screen_Shot_2018-10-25_at_10.36.03

http://profiler.gitlap.com/20181022/867a92d1-c5c3-423b-a657-69f22c7e550c.html.gz

How

We currently have a separate class for diff highlighting cache Gitlab::Diff::HighlightCache. I believe we could extend that to not only cache the highlighting of a whole diff collection, but for separate diff files as well.

Downside: Spend more memory caching a reasonably big content.

Edited by Oswaldo Ferreira