I think you are running into a silent deprecation warning. Use --depwarn=yes to get
ERROR: broadcast will default to iterating over its arguments in the future. Wrap arguments of
type `x::Exponential{Float64}` with `Ref(x)` to ensure they broadcast as "scalar" elements.
and then fixing as
a[i] = mean(logpdf.(Ref(d), y))
yields
julia> @benchmark main()
BenchmarkTools.Trial:
memory estimate: 34.02 KiB
allocs estimate: 102
--------------
minimum time: 33.536 μs (0.00% GC)
median time: 34.602 μs (0.00% GC)
mean time: 43.728 μs (13.85% GC)
maximum time: 42.665 ms (99.88% GC)
--------------
samples: 10000
evals/sample: 1
julia> VERSION
v"0.7.0-beta.204"
vs
julia> @benchmark main()
BenchmarkTools.Trial:
memory estimate: 34.02 KiB
allocs estimate: 102
--------------
minimum time: 52.695 μs (0.00% GC)
median time: 53.716 μs (0.00% GC)
mean time: 60.395 μs (1.65% GC)
maximum time: 837.051 μs (87.87% GC)
--------------
samples: 10000
evals/sample: 1
julia> VERSION
v"0.6.3"
which is a reasonable improvement, demoing v0.7 awesomeness.