High CPU usage on MRs with large diffs

Resources

FE @brycepj

When viewing an MR with a large diff, CPU usage stays very high (50 - 100%) and UX is degraded significantly.

Reproduce it here: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7527/diffs?expand_all_diffs=1

slow-browser

Edited by Filipa Lacerda