Don't highlight all lines of a blob when not needed
From the discussion in this MR (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/30606#note_193646191), it was pointed out that we are highlighting all lines of a blob even though we don't need them all to be highlighted (e.g. unfolding more diff lines). This eats a ton of memory and cpu-cycles for long files.
Currently, the Gitlab::Highlight#highlight
method doesn't support doing that. This issue is for looking into add support for that and ensure other places where the said method is used still work as expected. It's also good to get some baseline numbers and compare it with the changes applied.
Edited by Patrick Bajao