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

[Patch] Allow for type-hinting the method receiver in memfn

    Details

    • Approval:
      Ok
    • Patch:
      Code

      Description

      The attached patch copies metadata given to the method name symbol of memfn to the method receiver in the expansion. That way, memfn is able to be used even for type-hinted calls resulting in a big performance win.

      user> (time (dotimes [i 1000000] ((memfn intValue) 1)))
      Reflection warning, NO_SOURCE_FILE:1 - call to intValue can't be resolved.
      "Elapsed time: 2579.229115 msecs"
      nil
      user> (time (dotimes [i 1000000] ((memfn ^Number intValue) 1)))
      "Elapsed time: 12.015235 msecs"
      nil
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tsdh Tassilo Horn
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: