Out of interest, I ran the benchmarks as is, and got more or less the same 
results - 15x. Then I tried upgrading the defun dependencies - clojure, 
core.match and tools.macro - all of which have newer versions, and then running 
the benchmarks without leiningen’s jvm-opts and in a trampolined repl. The 
results are better (see below). Still not great - but down from 15x to 10x. 

That said:

* I’m not sure I’d care: for most applications the overhead of function 
dispatch is probably not the bottleneck.
* Elixir and the BEAM VM are awesome at many things, but I suspect (from 
experience not evidence) that the defun version is still faster than the elixir 
version.


Rob

---

user=> (bench (accum-defn 10000))
WARNING: Final GC required 2.590098761776679 % of runtime
Evaluation count : 429360 in 60 samples of 7156 calls.
             Execution time mean : 139.664539 µs
    Execution time std-deviation : 4.701755 µs
   Execution time lower quantile : 134.451108 µs ( 2.5%)
   Execution time upper quantile : 150.214646 µs (97.5%)
                   Overhead used : 1.565276 ns

Found 5 outliers in 60 samples (8.3333 %)
        low-severe       5 (8.3333 %)
 Variance from outliers : 20.5880 % Variance is moderately inflated by outliers

user=> (bench (accum-defun 10000))
Evaluation count : 44940 in 60 samples of 749 calls.
             Execution time mean : 1.361631 ms
    Execution time std-deviation : 40.489537 µs
   Execution time lower quantile : 1.333474 ms ( 2.5%)
   Execution time upper quantile : 1.465123 ms (97.5%)
                   Overhead used : 1.565276 ns

Found 9 outliers in 60 samples (15.0000 %)
        low-severe       1 (1.6667 %)
        low-mild         8 (13.3333 %)
 Variance from outliers : 17.3434 % Variance is moderately inflated by outliers

---


> On 5 Sep 2015, at 05:16, Amith George <strider...@gmail.com> wrote:
> 
> Nice. Hadn't heard of it before. It looks interesting. The criterium 
> benchmark is kinda disappointing though. The pattern matched function took 
> nearly 15x the time of the normal function.

-- 
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/d/optout.

Reply via email to