Uploaded image for project: 'Clojure'
  1. CLJ-1601

transducer arities for map-indexed, distinct, and interpose

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: None
    • Fix versions: Release 1.7
    • Labels:
    • Approval:
      Ok
    • Patch:
      Code and Test

      Description

      • with generative tests
      • with examples demonstrating performance

      Performance: Details in comments, summary:

      (def v (vec (concat (range 1000) (range 1000))))
      (into [] (distinct v))            ;; 821.3 µs
      (into [] (distinct) v)            ;; 388.2 µs
      (into [] (interpose nil v))       ;; 316.0 µs
      (into [] (interpose nil) v)       ;; 35.5 µs
      (into [] (map-indexed vector v))  ;; 76.8 µs
      (into [] (map-indexed vector) v)  ;; 49.4 µs
      

      Patch: clj-1601-4.patch

      Screening note: We could use transients to improve performance of the distinct impl, except checking containment in a transient set is broken per CLJ-700 Closed (which is not currently in 1.7). I have a new patch and direction on CLJ-700 Closed that could provide a way to solve that if we want to move it back and push this further. Or we could just wait and refactor when CLJ-700 Closed does go in.

      Screened by:

        Attachments

        1. clj-1601.patch
          5 kB
        2. clj-1601-2.patch
          8 kB
        3. clj-1601-3.patch
          8 kB
        4. clj-1601-4.patch
          8 kB
        5. clj-1601-transient-distinct.patch
          2 kB

          Activity

            People

            • Assignee:
              alexmiller Alex Miller
              Reporter:
              stu Stuart Halloway
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: