Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple programs run for many seconds #765

Open
1 task done
yurivict opened this issue Sep 1, 2022 · 8 comments
Open
1 task done

Simple programs run for many seconds #765

yurivict opened this issue Sep 1, 2022 · 8 comments

Comments

@yurivict
Copy link
Contributor

yurivict commented Sep 1, 2022

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Checked that your issue isn't already filed.
    • Reduced the issue to a self-contained, reproducible test case.

Description

Simple type programs run for many seconds. For instance, this example runs for many seconds both on the website and when run from the terminal.

Versions

Version: 3.48.0

@gebner
Copy link
Member

gebner commented Sep 2, 2022

I can't reproduce this issue. The live version on the website takes a couple of seconds to load (no matter the file), but after that your example is instantaneous.

@yurivict
Copy link
Contributor Author

yurivict commented Sep 2, 2022

Is C++ compiled version instantaneous for you on simple scripts?
Then I need to profile it.

@gebner
Copy link
Member

gebner commented Sep 2, 2022

It takes around 350ms.

@yurivict
Copy link
Contributor Author

yurivict commented Sep 2, 2022

Simple program takes ~22 sec on FreeBSD:

$ time lean simple.lean 
m : ℕ

real	0m22.868s
user	0m51.723s
sys	0m0.505s

@yurivict
Copy link
Contributor Author

yurivict commented Sep 3, 2022

I got this profile:
image

Some functions are called 1.5+ billion times, and many functions are called over 500 million times.
I don't think you even have so many objects of any kind. Some of the algorithms are obviously inefficient.

C++ library is different on FreeBSD, this might have causes the compiler to interpret some code differently.

@yurivict
Copy link
Contributor Author

yurivict commented Sep 3, 2022

I am pretty sure that there is a C++ problem in the code. Maybe some shared_ptr is copied often when this isn't needed - passing by address usually suffices.

@gebner
Copy link
Member

gebner commented Sep 5, 2022

I think all you need to do is:

cd lean/library
lean --make

@yurivict
Copy link
Contributor Author

yurivict commented Sep 5, 2022

This solved the problem.

But why isn't this done in the course of normal build?
There is the code for this in CMakeLists.txt, but it isn't run for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants