Performance, functional programming and collections in Swift