lean-dojo / LeanDojo

Tool for data extraction and interacting with Lean programmatically.
https://leandojo.org
MIT License
565 stars 88 forks source link

Faster recursive loading of indexed content #61

Closed josojo closed 1 year ago

josojo commented 1 year ago

Currently, loading traced repos ( by running TracedRepo.load_from_disk) of simple repos like the https://github.com/yangky11/lean4-example takes quite some time on my machine.

I reduced the time by a factor of nearly 10x by loading only the needed traced files. This means we first only read the traced files of the main repo and then only the traced libraries that we really depend on when building the dependency graph.

This PR is quite important for me as it allows me to iterate much quicker on the code, as simple tests take much shorter. If we use the same tracing technique, then the unit tests would run on small machines at reasonable times. But this is for a future PR.

Since this recursive loading is not guaranteed to be faster(it's not so easy to parallelize), I put the recursive loading behind a FLAG.

yangky11 commented 1 year ago

That's great, thanks! I've been a bit swamped with LeanInfer recently and will take a look when I get a chance.

josojo commented 1 year ago

@CodiumAI-Agent /review

CodiumAI-Agent commented 1 year ago

PR Analysis

How to use

Tag me in a comment '@CodiumAI-Agent' and add one of the following commands: /review [-i]: Request a review of your Pull Request. For an incremental review, which only considers changes since the last review, include the '-i' option. /describe: Modify the PR title and description based on the contents of the PR. /improve [--extended]: Suggest improvements to the code in the PR. Extended mode employs several calls, and provides a more thorough feedback. /ask \<QUESTION>: Pose a question about the PR. /update_changelog: Update the changelog based on the PR's contents.

To edit any configuration parameter from configuration.toml, add --config_path=new_value For example: /review --pr_reviewer.extra_instructions="focus on the file: ..." To list the possible configuration parameters, use the /config command.

yangky11 commented 1 year ago

Merging to dev and will update main after testing.

yangky11 commented 1 year ago

@josojo Please see the comment in the code. Since it has been merged into dev, I can make necessary changes in the code, but I want to check with you first.

yangky11 commented 1 year ago

@josojo Could you please take a look at https://github.com/lean-dojo/LeanDojo/pull/63 to see if it's reasonable? Thanks!