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

template_add/nested/triple are slow to compile #63

Open
certik opened this issue Feb 16, 2023 · 6 comments
Open

template_add/nested/triple are slow to compile #63

certik opened this issue Feb 16, 2023 · 6 comments

Comments

@certik
Copy link
Contributor

certik commented Feb 16, 2023

In this example, when you modify the print statement, it takes a noticeable lag after clicking Run to see the results. It's still a fraction of a second, but it's noticeable. While most other examples run immediately. Why would that be? This example is very simple, so I would expect things to run immediately.

@Shaikh-Ubaid
Copy link
Member

Shaikh-Ubaid commented Feb 16, 2023

Could you share the updated/modified example, please?

PS: There seems some minor delay. We should benchmark and/or debug.

@certik
Copy link
Contributor Author

certik commented Feb 16, 2023

Could you share the updated/modified example, please?

This one:

template_add: `module template_add_m

@certik
Copy link
Contributor Author

certik commented Apr 3, 2023

Most examples compile quickly. The goal is to always compile under 30ms, which most people perceive as "immediate".

I noticed the following examples compile slowly:

  • template_add: 130ms
  • template_nested: 126ms
  • template_triple: 113ms

All other template examples compile under 30ms.

We should be running LFortran in Release mode (#80), which might completely fix this. If it does not, then we need to investigate.

We also need to test locally how LFortran performs from the command line.

@certik certik changed the title template_add seems slow to compile template_add/nested/triple are slow to compile Apr 3, 2023
@Shaikh-Ubaid
Copy link
Member

In release mode, the compilation time seems to be less than 30ms for template_add and template_nested. For template_triple, it is around ~60ms. I think we need to optimize the flow.

@certik
Copy link
Contributor Author

certik commented Apr 5, 2023

Perfect, so just template_triple needs to be optimized. Not the highest priority right now, but we should investigate what is slowing it down, in case there is something in our design that we need to fix. CC @ansharlubis as well, if you know what could be causing it, let us know.

@ansharlubis
Copy link

A possible reason is that we track requirements and templates with maps inside the compiler instead of defining them in the ASR, I figure this adds some unnecessary memory access during compilation.

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

3 participants