FWIW a third option to determine the exact method called is
jvm.tools.analyzer:

clojure.tools.analyzer=> (clojure.pprint/pprint (ast (+ 1 2)))
{:op :static-method,
 :env
 {:source "NO_SOURCE_FILE",
  :column 29,
  :line 1,
  :locals {},
  :ns {:name clojure.tools.analyzer}},
 :class clojure.lang.Numbers,
 :method-name "add",
 :method
 {:name add,
  :return-type long,
  :declaring-class clojure.lang.Numbers,
  :parameter-types [long long],
  :exception-types [],
  :flags #{:static :public}},
 :args
 ({:op :number,
   :env {:locals {}, :ns {:name clojure.tools.analyzer}},
   :val 1}
  {:op :number,
   :env {:locals {}, :ns {:name clojure.tools.analyzer}},
   :val 2}),
 :tag nil}
nil

Thanks,
Ambrose


On Sat, Jun 8, 2013 at 5:59 AM, Zach Tellman <ztell...@gmail.com> wrote:

> What (+ x y) compiles down is highly dependent on the surrounding context,
> including but not limited to the local type-hints and the value of
> *unchecked-math*.  Actually verifying that it's calling the primitive,
> unboxed, easily inlined clojure.lang.Numbers.add(long, long) requires
> either a profiler or a decompiler.
>
> For a lot of use cases, this doesn't matter.  But where it does matter, it
> tends to turn into a mind-numbing cycle of adding type-hints, seeing
> whether that changed the compilation output, and then trying again.  Since
> I've gone through this more times than I'd like to admit, I rolled my own:
> https://github.com/ztellman/primitive-math.
>
> This is not meant to be a replacement for Clojure's numeric tower, rather
> it's meant to supplement it when the range of possible inputs is
> intentionally narrow.  I expect this should be immediately useful in a
> variety of applications and libraries.
>
> If anyone has questions, I'm happy to answer them.
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to