carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.
Apache License 2.0
5.52k stars 173 forks source link

Trying to compile nested let takes up a lot of resource #1463

Open mikecat opened 3 months ago

mikecat commented 3 months ago

I'm trying Carp 0.5.5 on Windows (using released binary).

When I tried to compile this code:

(defn test [] 42)

(let [s (prn (test))]
  (IO.println &s)
)

With a command line:

carp -b test.carp

It failed saying 'clang-cl.exe' is not recognized in a few seconds.
I don't think this failure is not a large problem here: It is suggesting that I should find or create the executable file in some way if I want to go further.

However, when I tried to compile this code in the same way:

(defn test [] 42)

(let [a (test)]
  (let [s (prn a)]
    (IO.println &s)
  )
)

The compiler used almost 100% of the CPU for at least several minutes, and it used more than 20GB of memory.

I think this usage of resources is too much for trying to compile this simple code.