When the collection-type inference proves an argument's type, number?/ string?/keyword?/record?/nil?/some? fold to a compile-time boolean. A const-fold now runs after inference so a folded predicate propagates and collapses any if it gates to the taken branch. Sound by construction: only a provable answer folds, and only when the argument is side-effect-free (a const or local) so dropping its evaluation is a no-op. Unknown types (:any/:truthy) and impure args keep the call. vector?/set?/map? are left out — the :vec tag conflates a real vector with a range/seq, so vector? could be wrong. 50M-iter loop, same shape isolated with a carry-only control: number? call+ branch 5080ms, predicate folded 1365ms — matching the 1417ms control floor, so the 3.7x is entirely the eliminated call+branch. Co-authored-by: Yogthos <yogthos@gmail.com> |
||
|---|---|---|
| .. | ||
| bench | ||
| clojure-stdlib/clojure | ||
| integration | ||
| spec | ||
| support | ||
| unit | ||