See the performance tips page in the manual: Performance Tips · The Julia Language
In particular, you’re accessing a global untyped variable (v), and there are possibly also issues with the way you capture it in the closure. Both issues are covered on that page. Also possibly check the BenchmarkTools.jl Readme and docs, they also cover these issues.