GitHub domFunctions.getCodeElementByLineNumber() should not call isDomSplitView() on every call
Created by: felixfbecker
I noticed bad decorations performance on GitHub and profiling revealed time is spent in heavy querySelector()
calls inside isDomSplitView()
, which is called on every call to getCodeElementByLineNumber()
, which is called for every line decoration.
getCodeElementByLineNumber()
finds the lineNumberCell
first, from there it should be easy to infer unified or split view by checking the number of cells in the row.
This is a requirement to implementing decoration support on diffs, because on PRs this has a big perf impact.
Before changing this, we need to add tests for the DOM functions to make sure the function will still work on GitHub, GHE and Refined GitHub (Enterprise).