question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with speed/output of goal display (1s in CoqIDE, 3min in VSCoq)

See original GitHub issue

Running over the following Coq snippet:

Require Import ZArith.

Open Scope Z.

Goal forall x, x>=15000.
intros x.
cbv.

takes about 1s in CoqIDE (until the result is displayed - CoqIDE does not block) and about 3 minutes in VsCoq (it blocks for this time).

Also the output is not the same - although I tried to ensure all display settings are the same (e.g. by restarting CoqIDE and VSCoq). For 10 instead of 15000 I get in CoqIDE:

1 goal
x : Z
______________________________________(1/1)
match x with
| 10 => Eq
| 0 | 7 | 9 | 5 | 3 | 6 | 8 | 4 | 2 | 1 | Z.neg _ => Lt
| _ => Gt
end = Lt -> False

and in VsCoq

x: Z
1/1
match x with
| Z.pos x' =>
    match x' with
    | (p~1)%positive =>
        match p with
        | (p0~1)%positive =>
            match p0 with
            | (p1~1)%positive | (p1~0)%positive => match p1 with
                                                   | (_~1)%positive | _ => Gt
                                                   end
            | 1%positive => Lt
            end
        | (p0~0)%positive =>
            match p0 with
            | (p1~1)%positive => match p1 with
                                 | (_~1)%positive | _ => Gt
                                 end
            | (p1~0)%positive => match p1 with
                                 | 1%positive => Lt
                                 | _ => Gt
                                 end
            | 1%positive => Lt
            end
        | 1%positive => Lt
        end
    | (p~0)%positive =>
        match p with
        | (p0~1)%positive =>
            match p0 with
            | (p1~1)%positive => match p1 with
                                 | (_~1)%positive | _ => Gt
                                 end
            | (p1~0)%positive => match p1 with
                                 | 1%positive => Eq
                                 | _ => Gt
                                 end
            | 1%positive => Lt
            end
        | (p0~0)%positive =>
            match p0 with
            | (p1~1)%positive => match p1 with
                                 | (_~1)%positive | _ => Gt
                                 end
            | (p1~0)%positive => match p1 with
                                 | 1%positive => Lt
                                 | _ => Gt
                                 end
            | 1%positive => Lt
            end
        | 1%positive => Lt
        end
    | 1%positive => Lt
    end
| _ => Lt
end = Lt -> False

I am not sure if the slowness is caused by the larger terms or is a general issue.

The example is nice to test this, because it produces terms which don’t (easily) run into the nesting limit (producing ...) and can produce terms of arbitrary size.

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Blaisorbladecommented, Dec 13, 2022

Submitted. I don’t consider this high quality, but perfect is the enemy of the good. @4ever2 since you did the lion’s share of the work and understand the code in question better than me, would you be willing to take a look, or submit a better patch?

1reaction
4ever2commented, Dec 12, 2022

The difference in the output is because of the Printing Matching setting. However, switching the setting does not solve the performance issue.

I also noticed that VsCoq sometimes is very slow at showing goals even though coqtop responds quickly (if you do Time cbv in the above example it says that the command finished in a few milliseconds).

I looked into this a while ago and the reason for this slowdown is due to proof diffs. For some reason, VsCoq doesn’t use the proof diff option built into Coq. Instead, the diff is computed by the extension using some very slow code. Sadly VsCoq doesn’t provide an option to disable proof diffs, so the only workaround right now is to remove the following line: https://github.com/coq-community/vscoq/blob/b5da0a8422d9027b9064956be787200d2f762d52/server/src/stm/State.ts#L200

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · coq-community/vscoq - GitHub
A Visual Studio Code extension for Coq [maintainers=@maximedenes,@huynhtrankhanh ... Issues with speed/output of goal display (1s in CoqIDE, 3min in VSCoq).
Read more >
How to activate the messages window in vscode like the ...
I am expecting something in my messages bar but I don't see it Example script: Fixpoint add_left (n m : nat) : nat...
Read more >
coq-community/vscoq - Gitter
Hello ! I installed the VSCoq extension on VS code and I have the error on the bottom of window "coqtop is not...
Read more >
How to activate the Coq messages in vscode/vscoq like in the ...
https://coq.discourse.group/t/how-to-activate-the-messages-window-in-vscode-like-the-coqide-has/1584.
Read more >
CoqIDE — Coq 8.16.1 documentation
Its main purpose is to allow users to edit Coq scripts and step forward and backward through them. Stepping forward executes commands and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found