slightly improved implementation of mean

- regionsize is moved to reducedim.jl
- avoid a temporary allocation in mean(x, region)
Merge pull request #5309 from lindahua/dh/mean2

slightly improved implementation of mean