Open
Description
Hello. During my progress in the compiler course I've encountered a possible bug in lamac.
Scenario
- Add
case ... of
construction to the code - Add a considerable number (10+) of string patterns
- Add function call using dot notation after
->
- 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:
- 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
- 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