Jumping-to-line in a file sometimes appears to hang for several seconds
Created by: mrnugget
See this Slack thread for more details, but I'll try to reproduce here.
I wrote:
I'm often confused when I get a sourcegraph link to a specific line in a file, I click on it, and I don't jump to the line. I then realise it's because the jump-to-line functionality waits for the extensions to load, which can take 3-5 seconds in my experience.
Example links:
- https://sourcegraph.com/github.com/golang/go/-/blob/src/os/exec/exec.go#L664
- https://sourcegraph.com/github.com/rust-lang/rust/-/blob/compiler/rustc_middle/src/mir/mod.rs#L1870
Video:
https://user-images.githubusercontent.com/1185253/120309080-1751ee00-c2d5-11eb-8d85-7878a49206ad.mp4
But I can't reliably reproduce this: when clicking the same links again now I can't reproduce the behaviour.
@felixfbecker dug into this and managed to capture a profile. Reconstructing his Slack message here:
I just took a quick profile and the majority of time is actually spent on painting! Each of the green "Composite Layers" blocks is almost half a second long (and is blocking the main thread). It's hard to figure out what exactly makes it take that long, but at its core these are responses of the browser to React rerendering something and needing to paint it, and with the many DOM nodes from syntax highlighting, the table layout and potentially even changes introduced from the redesign there could be many reasons why the browser takes this long to apply an update.
