Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: None
    • Labels:
      None
    • Patch:
      Code

      Description

      0001-PersistentHashMap-ported-from-Clojure.patch contains a port of Clojure's PersistentHashMap.

      0002-...-.patch rewires cljs.core/hash-map and cljs.compiler/emit's :map method to use cljs.core.PersistentHashMap. With that in place, the regular cljs test suite runs fine.

      As a quick sanity check,

      (loop [m cljs.core.PersistentHashMap/EMPTY i 0]
        (if (< i 10000)
          (recur (assoc m i :foo) (inc i))
          (loop [i 0]
            (if (< i 10000)
              (do (assert (= :foo (get m i)))
                  (recur (inc i)))))))
      

      runs fine under Rhino. Timing this loop produces the expected results: it takes 1.1s on my machine as written above and 10.5s with cljs.core.HashMap/EMPTY bound to m. With 100000 iterations, PersistentHashMap takes 11.8s, whereas HashMap takes forever.

      TODO:

      • iron out any remaining bugs, add in missing protocols (if any) etc.,
      • test HashCollisionNode and related code,
      • use other map types for small maps and switch at some threshold.

      See https://groups.google.com/d/topic/clojure-dev/DMcV4QwApuY/discussion.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michalmarczyk Michał Marczyk
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: