Hi Tom,

Mose: what version of julia are you on? Anonymous functions and closures 
> are much faster on 0.5... In fact there should be no performance penalty vs 
> regular functions, which allows you to rethink your paradigm. 
>

It was Julia 0.4.6, but I get similar results also with Julia 0.6-dev.72:

julia> using BenchmarkTools, AutoGrad

julia> COS = grad(sin)
(::gradfun) (generic function with 1 method)

julia> @benchmark cos(0.0)
BenchmarkTools.Trial: 
  samples:          10000
  evals/sample:     1000
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  0.00 bytes
  allocs estimate:  0
  minimum time:     6.00 ns (0.00% GC)
  median time:      6.00 ns (0.00% GC)
  mean time:        6.03 ns (0.00% GC)
  maximum time:     19.00 ns (0.00% GC)

julia> @benchmark COS(0.0)
BenchmarkTools.Trial: 
  samples:          10000
  evals/sample:     1
  time tolerance:   5.00%
  memory tolerance: 1.00%
  memory estimate:  4.05 kb
  allocs estimate:  71
  minimum time:     23.07 μs (0.00% GC)
  median time:      24.27 μs (0.00% GC)
  mean time:        25.36 μs (1.63% GC)
  maximum time:     4.23 ms (97.76% GC)

Bye,
Mosè

Reply via email to