Disable annotation for long lines

For performance reason, we are skipping annotation of long lines.
Diff loading for long line (around 3000 character long) was 5.5s before
this change and 1.4s after this change.

Change-Id: If1b588f3fdb3926e841f1e6789e5ebb55e61bba7
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
index 601ea80..9574c1d 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
+++ b/polygerrit-ui/app/elements/diff/gr-diff-builder/gr-diff-builder.ts
@@ -716,10 +716,19 @@
       }
 
       if (lineNumberEl) {
-        for (const layer of this.layers) {
-          if (typeof layer.annotate === 'function') {
-            layer.annotate(contentText, lineNumberEl, line);
+        const ANNOTATE_MAX_LINE_LENGTH = 1000;
+        // For performance reason, we skip annotating long lines.
+        if (line.text.length < ANNOTATE_MAX_LINE_LENGTH) {
+          for (const layer of this.layers) {
+            if (typeof layer.annotate === 'function') {
+              layer.annotate(contentText, lineNumberEl, line);
+            }
           }
+        } else {
+          const msg =
+            `A line is longer than ${ANNOTATE_MAX_LINE_LENGTH}.` +
+            ' Line annotation was skipped.';
+          console.warn(msg);
         }
       } else {
         console.error('The lineNumberEl is null, skipping layer annotations.');