Skip to content

Instantly share code, notes, and snippets.

View ndkhoa96's full-sized avatar

Khoa Nguyen ndkhoa96

  • Ho Chi Minh, Viet Nam
View GitHub Profile
@toshi0383
toshi0383 / map.swift
Last active January 10, 2021 08:59
Custom map implementation performance test in Swift
import Foundation
// used in map5
let queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
let group = dispatch_group_create()
extension Array {
func map2<U>(transform: Element ->U) -> [U] {
return reduce([]) {
$0 + [transform($1)]