<< Back to previous view

[CTYP-83] check-ns takes exponentially longer on each invocation Created: 04/Oct/13  Updated: 20/Jul/15  Resolved: 01/Sep/14

Status: Closed
Project: core.typed
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Blocker
Reporter: Hugo Duncan Assignee: Ambrose Bonnaire-Sergeant
Resolution: Completed Votes: 0
Labels: None


Running `(check-ns pathological)` repeatedly on the following namespace, `check-ns` takes longer and longer to complete.

(ns pathological
   [clojure.core.typed :refer [ann def-alias loop>
                               NonEmptyVec NilableNonEmptySeq]]))

(def-alias VersionVector (NonEmptyVec Number))
(ann version-less [(U nil VersionVector) (U nil VersionVector) -> boolean])
(defn version-less
  "Compare two version vectors."
  [v1 v2]
  (loop> [v1 :- (NilableNonEmptySeq Number) (seq v1)
          v2 :- (NilableNonEmptySeq Number) (seq v2)]
    (let [fv1 (first v1)
          fv2 (first v2)]
       (and (not v1) (not v2)) false
       (and v1 (not v2)) false
       (or (and (not v1) v2)
           (and fv1 fv2 (< fv1 fv2))) true
           (and fv1 fv2 (> fv1 fv2)) false
           :else (recur (next v1) (next v2))))))

Comment by Ambrose Bonnaire-Sergeant [ 01/Sep/14 3:41 PM ]

Fix will be included in 0.2.68 https://github.com/clojure/core.typed/commit/0065e05fa20c3c33dea49937558af0933c363125

Generated at Thu Feb 23 08:41:30 CST 2017 using JIRA 4.4#649-r158309.