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

amap calls `alength` at every iteration step

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.8
    • Fix versions: Release 1.9
    • Environment:

      JVM

    • Approval:
      Ok
    • Patch:
      Code

      Description

      During the 1.7 => 1.8 upgrade `areduce` was fixed to not call `alength` on the same thing, at every single iteration step. However, `amap` which suffers from the same issue was not fixed (even though exactly the same fix applies).

      Example:

      (def an-array (long-array 100000 0))
      (dotimes [_ 50]
        (time (amap ^longs an-array idx ret (+ 1 (aget ^longs an-array idx)))))
      

      Before (last time): 0.3930 ms
      After (last time): 0.3459 ms

      Patch: fix_amap.patch

      Screened by: Alex Miller

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jimpil Dimitrios Piliouras
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: