Zulip Chat Archive

Stream: new members

Topic: Speeding up the lean infoview


view this post on Zulip Jakob Scholbach (Mar 25 2021 at 19:42):

What are ways to speed up the interactive lean parser in VS Code? I often have a situation where the program takes minutes to check if my code works. In the case I just have I have edited a file that was already part of mathlib (category/arrows.lean). That file does compile and the lean infoview is reasonably quick to update. However, another file that builds upon arrows.lean is extremely slowly / not at all reacting in the infoview. Thanks!

view this post on Zulip Yakov Pechersky (Mar 25 2021 at 19:44):

Have you done lean --make your/path/to/target.lean? That will compile oleans for that file and all dependencies

view this post on Zulip Jakob Scholbach (Mar 25 2021 at 19:46):

No, I have not. Do I need to do that regularly?

view this post on Zulip Jakob Scholbach (Mar 25 2021 at 19:49):

By your/path/to/target.lean/ you mean the git repo folder containing the mathlib copy? (I am working in a copy of mathlib).

view this post on Zulip Thomas Browning (Mar 25 2021 at 20:05):

Oleans can help. If you're working on a branch of mathlib, then you can make your change to an existing file, push, wait a couple hours, and then do leanproject get-cache

view this post on Zulip Johan Commelin (Mar 25 2021 at 20:06):

@Jakob Scholbach Yeah, if there are 10 files between arrows.lean and the file you work on, Lean has to do a lot of work in between.

view this post on Zulip Johan Commelin (Mar 25 2021 at 20:07):

So it makes sense to recompile before resuming work on your file

view this post on Zulip Johan Commelin (Mar 25 2021 at 20:07):

If you ever edit logic.basic you will have the joy of waiting for 2 hours before mathlib is recompiled :grinning:

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:08):

Unless you use lean --old

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:09):

With --old Lean will assume that your changes to logic/basic don't affect the files you did not edit.

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:10):

Of course, this doesn't work if you change the type of a def/lemma.

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:10):

(as opposed to adding new defs/lemmas)

view this post on Zulip Jakob Scholbach (Mar 25 2021 at 20:10):

Ah, that is good. In my case I just added a def to arrow.lean, which wouldn't affect anything else. So, I run lean --old in the terminal once and then this will do it?

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:14):

No, you need to pass --old argument to the lean server process.

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 20:14):

This should be somewhere in the lean extension settings (I'm using Emacs, so can't help with the details).

view this post on Zulip Bryan Gin-ge Chen (Mar 25 2021 at 20:28):

In VS Code, you'd add --old to the box under "Extra command-line options for the Lean server" in the extension settings.

view this post on Zulip Scott Morrison (Mar 25 2021 at 21:49):

I'd advise not getting too complicated with lean --old. If you're plugged into power, just leave lean --make current_work.lean buzzing along in a terminal...

view this post on Zulip Yury G. Kudryashov (Mar 25 2021 at 23:06):

I always pass --old to lean server and run lean --make current_work.lean from time to time.

view this post on Zulip Scott Morrison (Mar 26 2021 at 00:31):

Maybe I should try this more!


Last updated: May 14 2021 at 23:14 UTC