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

Lamac big execution time #5

Open
merge34 opened this issue Mar 16, 2020 · 1 comment
Open

Lamac big execution time #5

merge34 opened this issue Mar 16, 2020 · 1 comment
Assignees
Labels
test case Witnesses an error in other library

Comments

@merge34
Copy link

merge34 commented Mar 16, 2020

Hello. During my progress in the compiler course I've encountered a possible bug in lamac.

Scenario

  1. Add case ... of construction to the code
  2. Add a considerable number (10+) of string patterns
  3. Add function call using dot notation after ->
  4. Run lamac <file name>

Problem
In the described scenario lamac execution time grows exponentially as the number of patterns grows.

Expected behavior
Execution time in the described scenario is similar to the execution time of lamac without dot notation usage.

Example
Consider the following gist, in which I've implemented 2 semantically equivalent programs, according to specification:

  1. In file example1.lama I've implemented the described scenario without dot notation usage. So, without any dependence on N, we have something like:
$ time lamac test.lama
real    0m8,152s                                                                                                                   
user    0m8,037s  
sys     0m0,102s
  1. In file example2.lama I've implemented exactly described scenario. So, we have:
  • N = 0
$ time lamac test.lama
real    0m0,227s  
user    0m0,219s 
sys     0m0,009s
  • N = 3
$ time lamac test.lama          
real    0m4,357s                    
user    0m4,289s                   
sys     0m0,067s
  • N = 5
$ time lamac test.lama 
real    1m23,222s 
user    1m22,964s
sys     0m0,223s
  • N = 7
    Did not finish after 10 minutes of execution

Environment description

  • Ubuntu 18.04
  • Opam 2.0.5
  • OCaml 4.0.5
  • gcc-multilib 7.4.0
@dboulytchev
Copy link
Collaborator

Looks like Ostap issue with dot notation support. Should be postponed until hash-consing and proper memoization is implemented.

@dboulytchev dboulytchev self-assigned this Mar 17, 2020
@dboulytchev dboulytchev added the test case Witnesses an error in other library label Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test case Witnesses an error in other library
Projects
None yet
Development

No branches or pull requests

2 participants