back referential expressions can cause exponential compilation times

Description

Reported as causing problems in real world code: https://groups.google.com/forum/#!topic/clojure/Z91bhUvSB1g

With init.clj as :

Before patch:

After patch:

This is caused by every local bindings' type depending on the type of the previous binding, triggering an exponential number of calls to hasJavaClass and getJavaClass. By caching on first occurrence, the complexity becomes linear.

Patch: 0001-CLJ-2210-cache-non-trivial-getJavaClass-hasJavaClass.patch

Prescreened by: Alex Miller

Environment

None
Completed

Assignee

Unassigned

Reporter

Nicola Mometto

Approval

Ok

Patch

Code

Fix versions

Affects versions

Priority

Critical
Configure