A generator with two "for" keywords is slow

You are timing in global scope. Wrap everything in a function or use BenchmarkTools.jl instead.

EDIT: v is in global scope.

EDIT: Nonetheless, your observation seems to be correct.