Skip to content

🐛 delta is slow (noticeable lag) compared to default diff (11ms -> 76ms) in VSCode #1897

@certik

Description

@certik

I am using Ubuntu (WSL on Windows). The default git diff is immediate, while delta has a noticeable lag. As a rule of thumb, anything under 30ms feels immediate, but over 30ms you will notice a lag.

I don't know if the issue is with delta itself, or if this extra 65ms overhead is caused by launching the delta program from git, but unfortunately that makes it too slow for me, since I want these command line tools to feel immediate, the extra lag distracts me.

In VSCode console, default git diff:

$ time git diff
diff --git a/src/lfortran/parser/preprocessor.re b/src/lfortran/parser/preprocessor.re
index 1f39b3c58..67643a220 100644
--- a/src/lfortran/parser/preprocessor.re
+++ b/src/lfortran/parser/preprocessor.re
@@ -433,7 +433,7 @@ std::string CPreprocessor::run(const std::string &input, LocationManager &lm,
                 interval_end_type_0(lm, output.size(), cur-string_start);
                 continue;
             }
-            "#" whitespace? "include" whitespace '"' @t1 [^"\x00]* @t2 '"' [^\n\x00]* newline {
+            "#" whitespace? "include" whitespace ('"' | '<') @t1 [^"\x00]* @t2 ('"' | '>') [^\n\x00]* newline {
                 if (!branch_enabled) continue;
                 std::string filename = token(t1, t2);
                 std::vector<std::filesystem::path> include_dirs;

real    0m0.011s
user    0m0.013s
sys     0m0.000s

And delta:

$ time git diff

Δ src/lfortran/parser/preprocessor.re
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

─────────────────────────────────────────────────────────────────────────────────────┐
• 433: std::string CPreprocessor::run(const std::string &input, LocationManager &lm, │
─────────────────────────────────────────────────────────────────────────────────────┘
                interval_end_type_0(lm, output.size(), cur-string_start);
                continue;
            }
            "#" whitespace? "include" whitespace '"' @t1 [^"\x00]* @t2 '"' [^\n\x00]* newline {
            "#" whitespace? "include" whitespace ('"' | '<') @t1 [^"\x00]* @t2 ('"' | '>') [^\n\x00]* newline {
                if (!branch_enabled) continue;
                std::string filename = token(t1, t2);
                std::vector<std::filesystem::path> include_dirs;

real    0m0.076s
user    0m0.034s
sys     0m0.004s

I also tried the same thing directly in Terminal, and there I get 8ms with git diff and 27ms with delta, which is still a huge overhead, but fortunately it is under 30ms, and so it feels immediate.

So there are two separate issues:

  • large overhead of delta compared to native git diff (3x slower in Terminal, 6x slower in VSCode)
  • VSCode seems tiny bit slower for git diff, but a lot slower for delta

If you have any tips that I could try, let me know, I am happy to help debug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions