slightly improved implementation of mean

- regionsize is moved to reducedim.jl
- avoid a temporary allocation in mean(x, region)