Last active
June 10, 2020 14:18
-
-
Save mattt/7e46d1a26e29e12fb74347b70cfbb288 to your computer and use it in GitHub Desktop.
A benchmark comparing various methods of downloading popular Swift packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Alamofire": { | |
| "name": "Alamofire", | |
| "url": "https://github.com/Alamofire/Alamofire", | |
| "version": "5.2.1" | |
| }, | |
| "Charts": { | |
| "name": "Charts", | |
| "url": "https://github.com/danielgindi/Charts", | |
| "version": "v3.5.0" | |
| }, | |
| "SDWebImage": { | |
| "name": "SDWebImage", | |
| "url": "https://github.com/SDWebImage/SDWebImage", | |
| "version": "5.8.0" | |
| }, | |
| "ReactiveCocoa": { | |
| "name": "ReactiveCocoa", | |
| "url": "https://github.com/ReactiveCocoa/ReactiveCocoa", | |
| "version": "10.3.0" | |
| }, | |
| "lottie-ios": { | |
| "name": "lottie-ios", | |
| "url": "https://github.com/airbnb/lottie-ios", | |
| "version": "3.1.8" | |
| }, | |
| "SwiftyJSON": { | |
| "name": "SwiftyJSON", | |
| "url": "https://github.com/SwiftyJSON/SwiftyJSON", | |
| "version": "5.0.0" | |
| }, | |
| "vapor": { | |
| "name": "vapor", | |
| "url": "https://github.com/vapor/vapor", | |
| "version": "4.8.0" | |
| }, | |
| "RxSwift": { | |
| "name": "RxSwift", | |
| "url": "https://github.com/ReactiveX/RxSwift", | |
| "version": "5.1.1" | |
| }, | |
| "Hero": { | |
| "name": "Hero", | |
| "url": "https://github.com/HeroTransitions/Hero", | |
| "version": "1.5.0" | |
| }, | |
| "SnapKit": { | |
| "name": "SnapKit", | |
| "url": "https://github.com/SnapKit/SnapKit", | |
| "version": "5.0.1" | |
| }, | |
| "Kingfisher": { | |
| "name": "Kingfisher", | |
| "url": "https://github.com/onevcat/Kingfisher", | |
| "version": "5.14.0" | |
| }, | |
| "MBProgressHUD": { | |
| "name": "MBProgressHUD", | |
| "url": "https://github.com/jdg/MBProgressHUD", | |
| "version": "1.2.0" | |
| }, | |
| "IQKeyboardManager": { | |
| "name": "IQKeyboardManager", | |
| "url": "https://github.com/hackiftekhar/IQKeyboardManager", | |
| "version": "v6.5.0" | |
| }, | |
| "realm-cocoa": { | |
| "name": "realm-cocoa", | |
| "url": "https://github.com/realm/realm-cocoa", | |
| "version": "v5.0.2" | |
| }, | |
| "Carthage": { | |
| "name": "Carthage", | |
| "url": "https://github.com/Carthage/Carthage", | |
| "version": "0.34.0" | |
| }, | |
| "SwiftLint": { | |
| "name": "SwiftLint", | |
| "url": "https://github.com/realm/SwiftLint", | |
| "version": "0.39.2" | |
| }, | |
| "PromiseKit": { | |
| "name": "PromiseKit", | |
| "url": "https://github.com/mxcl/PromiseKit", | |
| "version": "6.13.0" | |
| }, | |
| "Moya": { | |
| "name": "Moya", | |
| "url": "https://github.com/Moya/Moya", | |
| "version": "14.0.0" | |
| }, | |
| "CocoaAsyncSocket": { | |
| "name": "CocoaAsyncSocket", | |
| "url": "https://github.com/robbiehanson/CocoaAsyncSocket", | |
| "version": "7.6.4" | |
| }, | |
| "Eureka": { | |
| "name": "Eureka", | |
| "url": "https://github.com/xmartlabs/Eureka", | |
| "version": "5.2.1" | |
| }, | |
| "folding-cell": { | |
| "name": "folding-cell", | |
| "url": "https://github.com/Ramotion/folding-cell", | |
| "version": "5.0.2" | |
| }, | |
| "NVActivityIndicatorView": { | |
| "name": "NVActivityIndicatorView", | |
| "url": "https://github.com/ninjaprox/NVActivityIndicatorView", | |
| "version": "4.8.0" | |
| }, | |
| "SkeletonView": { | |
| "name": "SkeletonView", | |
| "url": "https://github.com/Juanpe/SkeletonView", | |
| "version": "1.8.6" | |
| }, | |
| "Quick": { | |
| "name": "Quick", | |
| "url": "https://github.com/Quick/Quick", | |
| "version": "v3.0.0" | |
| }, | |
| "SwifterSwift": { | |
| "name": "SwifterSwift", | |
| "url": "https://github.com/SwifterSwift/SwifterSwift", | |
| "version": "5.2.0" | |
| }, | |
| "ObjectMapper": { | |
| "name": "ObjectMapper", | |
| "url": "https://github.com/tristanhimmelman/ObjectMapper", | |
| "version": "4.2.0" | |
| }, | |
| "IBAnimatable": { | |
| "name": "IBAnimatable", | |
| "url": "https://github.com/IBAnimatable/IBAnimatable", | |
| "version": "6.1.0" | |
| }, | |
| "CryptoSwift": { | |
| "name": "CryptoSwift", | |
| "url": "https://github.com/krzyzanowskim/CryptoSwift", | |
| "version": "1.3.1" | |
| }, | |
| "swift-package-manager": { | |
| "name": "swift-package-manager", | |
| "url": "https://github.com/apple/swift-package-manager", | |
| "version": "0.6.0" | |
| }, | |
| "R.swift": { | |
| "name": "R.swift", | |
| "url": "https://github.com/mac-cain13/R.swift", | |
| "version": "v5.2.2" | |
| }, | |
| "PureLayout": { | |
| "name": "PureLayout", | |
| "url": "https://github.com/PureLayout/PureLayout", | |
| "version": "v3.1.6" | |
| }, | |
| "Kitura": { | |
| "name": "Kitura", | |
| "url": "https://github.com/IBM-Swift/Kitura", | |
| "version": "2.9.1" | |
| }, | |
| "Cartography": { | |
| "name": "Cartography", | |
| "url": "https://github.com/robb/Cartography", | |
| "version": "4.0.0" | |
| }, | |
| "SQLite.swift": { | |
| "name": "SQLite.swift", | |
| "url": "https://github.com/stephencelis/SQLite.swift", | |
| "version": "0.12.2" | |
| }, | |
| "Reachability.swift": { | |
| "name": "Reachability.swift", | |
| "url": "https://github.com/ashleymills/Reachability.swift", | |
| "version": "v5.0.0" | |
| }, | |
| "JTAppleCalendar": { | |
| "name": "JTAppleCalendar", | |
| "url": "https://github.com/patchthecode/JTAppleCalendar", | |
| "version": "8.0.3" | |
| }, | |
| "ReSwift": { | |
| "name": "ReSwift", | |
| "url": "https://github.com/ReSwift/ReSwift", | |
| "version": "5.0.0" | |
| }, | |
| "facebook-ios-sdk": { | |
| "name": "facebook-ios-sdk", | |
| "url": "https://github.com/facebook/facebook-ios-sdk", | |
| "version": "v7.0.0" | |
| }, | |
| "SwiftGen": { | |
| "name": "SwiftGen", | |
| "url": "https://github.com/SwiftGen/SwiftGen", | |
| "version": "6.1.0" | |
| }, | |
| "Starscream": { | |
| "name": "Starscream", | |
| "url": "https://github.com/daltoniam/Starscream", | |
| "version": "3.1.1" | |
| }, | |
| "swift-nio": { | |
| "name": "swift-nio", | |
| "url": "https://github.com/apple/swift-nio", | |
| "version": "2.18.0" | |
| }, | |
| "ViewAnimator": { | |
| "name": "ViewAnimator", | |
| "url": "https://github.com/marcosgriselli/ViewAnimator", | |
| "version": "2.7.0" | |
| }, | |
| "SwiftDate": { | |
| "name": "SwiftDate", | |
| "url": "https://github.com/malcommac/SwiftDate", | |
| "version": "6.1.0" | |
| }, | |
| "KeychainAccess": { | |
| "name": "KeychainAccess", | |
| "url": "https://github.com/kishikawakatsumi/KeychainAccess", | |
| "version": "v4.2.0" | |
| }, | |
| "Macaw": { | |
| "name": "Macaw", | |
| "url": "https://github.com/exyte/Macaw", | |
| "version": "0.9.6" | |
| }, | |
| "SwipeCellKit": { | |
| "name": "SwipeCellKit", | |
| "url": "https://github.com/SwipeCellKit/SwipeCellKit", | |
| "version": "2.7.1" | |
| }, | |
| "Nuke": { | |
| "name": "Nuke", | |
| "url": "https://github.com/kean/Nuke", | |
| "version": "9.1.0" | |
| }, | |
| "SwiftyStoreKit": { | |
| "name": "SwiftyStoreKit", | |
| "url": "https://github.com/bizz84/SwiftyStoreKit", | |
| "version": "0.16.0" | |
| }, | |
| "SwiftyBeaver": { | |
| "name": "SwiftyBeaver", | |
| "url": "https://github.com/SwiftyBeaver/SwiftyBeaver", | |
| "version": "1.9.1" | |
| }, | |
| "SwiftEntryKit": { | |
| "name": "SwiftEntryKit", | |
| "url": "https://github.com/huri000/SwiftEntryKit", | |
| "version": "1.2.3" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'benchmark' | |
| require 'tmpdir' | |
| require 'json' | |
| include Benchmark | |
| namespace :benchmark do | |
| task all: %i[full_clone shallow_clone curl_unzip] | |
| task full_clone: ['packages.json'] do | |
| banner 'clone' | |
| benchmark { |package| `git clone #{package['url']} --quiet` } | |
| end | |
| task shallow_clone: ['packages.json'] do | |
| banner 'shallow clone' | |
| benchmark { |package| `git -c advice.detachedHead=false clone --depth 1 --branch #{package['version']} #{package['url']} --quiet` } | |
| end | |
| task curl_unzip: ['packages.json'] do | |
| banner 'curl + unzip' | |
| benchmark { |package| `curl -s -L #{package['url']}/archive/#{package['version']}.zip -o #{package['name']}#{package['version']}.zip && unzip` } | |
| end | |
| end | |
| task default: 'benchmark:all' | |
| private | |
| def banner(title) | |
| puts | |
| puts | |
| puts title | |
| puts '-' * title.length | |
| end | |
| def benchmark | |
| raise unless block_given? | |
| packages = JSON.parse(File.read('packages.json')) | |
| length = packages.keys.map(&:length).max | |
| Dir.mktmpdir do |tmp| | |
| Dir.chdir(tmp) do | |
| Benchmark.bm(length) do |x| | |
| packages.each do |name, package| | |
| x.report(name.ljust(length, ' ')) { yield package } | |
| end | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| clone | |
| ----- | |
| user system total real | |
| Alamofire 0.000136 0.000850 0.749258 ( 1.448588) | |
| Charts 0.000083 0.000521 3.489720 ( 7.009554) | |
| SDWebImage 0.000083 0.000522 0.518336 ( 1.374356) | |
| ReactiveCocoa 0.000084 0.000533 1.125409 ( 1.682766) | |
| lottie-ios 0.000080 0.000517 0.677848 ( 2.008858) | |
| SwiftyJSON 0.000081 0.000541 0.115584 ( 0.580434) | |
| vapor 0.000085 0.000532 0.724292 ( 1.157188) | |
| RxSwift 0.000080 0.000515 1.008959 ( 1.230171) | |
| Hero 0.000085 0.000542 0.528742 ( 1.768519) | |
| SnapKit 0.000081 0.000551 0.129149 ( 0.513823) | |
| Kingfisher 0.000084 0.000521 0.912013 ( 1.819731) | |
| MBProgressHUD 0.000084 0.000536 0.122328 ( 0.452931) | |
| IQKeyboardManager 0.000086 0.000530 0.632610 ( 1.380802) | |
| realm-cocoa 0.000086 0.000527 2.343979 ( 3.209463) | |
| Carthage 0.000084 0.000534 0.710062 ( 1.500694) | |
| SwiftLint 0.000099 0.000572 1.575219 ( 3.197901) | |
| PromiseKit 0.000084 0.000535 0.267489 ( 0.851714) | |
| Moya 0.000084 0.000536 0.604540 ( 1.918609) | |
| CocoaAsyncSocket 0.000081 0.000529 0.231591 ( 0.683557) | |
| Eureka 0.000085 0.000539 0.502792 ( 2.481602) | |
| folding-cell 0.000085 0.000545 0.343322 ( 1.333463) | |
| NVActivityIndicatorView 0.000114 0.000539 0.176368 ( 0.759250) | |
| SkeletonView 0.000086 0.000529 0.179957 ( 0.826394) | |
| Quick 0.000083 0.000530 0.199310 ( 1.765293) | |
| SwifterSwift 0.000081 0.000518 0.448863 ( 2.627493) | |
| ObjectMapper 0.000082 0.000536 0.142047 ( 0.598192) | |
| IBAnimatable 0.000082 0.000522 0.554057 ( 1.842749) | |
| CryptoSwift 0.000078 0.000525 0.391980 ( 0.820891) | |
| swift-package-manager 0.000087 0.000539 0.869737 ( 1.320884) | |
| R.swift 0.000084 0.000542 0.220084 ( 0.672758) | |
| PureLayout 0.000082 0.000522 0.112897 ( 0.474636) | |
| Kitura 0.000079 0.000507 0.317610 ( 0.805428) | |
| Cartography 0.000079 0.000511 0.104570 ( 0.481281) | |
| SQLite.swift 0.000087 0.000541 0.169530 ( 0.624040) | |
| Reachability.swift 0.000081 0.000537 0.073578 ( 0.400479) | |
| JTAppleCalendar 0.000081 0.000516 0.174830 ( 0.546251) | |
| ReSwift 0.000080 0.000556 0.222758 ( 0.825881) | |
| facebook-ios-sdk 0.000096 0.000544 1.267827 ( 3.875306) | |
| SwiftGen 0.000084 0.000528 1.407960 ( 2.657347) | |
| Starscream 0.000087 0.000535 0.146574 ( 0.570999) | |
| swift-nio 0.000082 0.000511 1.402005 ( 2.307524) | |
| ViewAnimator 0.000082 0.000537 0.213198 ( 1.231248) | |
| SwiftDate 0.000085 0.000517 0.621065 ( 1.530479) | |
| KeychainAccess 0.000083 0.000527 0.122294 ( 0.525966) | |
| Macaw 0.000086 0.000524 1.629218 ( 3.734845) | |
| SwipeCellKit 0.000079 0.000563 0.219207 ( 0.787884) | |
| Nuke 0.000084 0.000522 0.248210 ( 0.694805) | |
| SwiftyStoreKit 0.000092 0.000584 0.150986 ( 0.707731) | |
| SwiftyBeaver 0.000082 0.000546 0.116533 ( 0.615893) | |
| SwiftEntryKit 0.000084 0.000518 0.654047 ( 2.576422) | |
| shallow clone | |
| ------------- | |
| user system total real | |
| Alamofire 0.000089 0.000987 0.181577 ( 1.276130) | |
| Charts 0.000099 0.000538 0.199058 ( 1.085956) | |
| SDWebImage 0.000085 0.000542 0.199057 ( 1.268511) | |
| ReactiveCocoa 0.000081 0.000538 0.101560 ( 0.747305) | |
| lottie-ios 0.000088 0.000581 0.302069 ( 1.390870) | |
| SwiftyJSON 0.000086 0.000539 0.099870 ( 0.649720) | |
| vapor 0.000085 0.000549 0.092695 ( 0.667052) | |
| RxSwift 0.000088 0.000557 0.208210 ( 1.160036) | |
| Hero 0.000086 0.000537 0.434481 ( 1.937651) | |
| SnapKit 0.000088 0.000566 0.098053 ( 0.615319) | |
| Kingfisher 0.000085 0.000543 0.170360 ( 1.069342) | |
| MBProgressHUD 0.000088 0.000552 0.073888 ( 0.597525) | |
| IQKeyboardManager 0.000084 0.000525 0.126740 ( 0.866729) | |
| realm-cocoa 0.000090 0.000533 0.241952 ( 1.360770) | |
| Carthage 0.000085 0.000570 0.268701 ( 1.323958) | |
| SwiftLint 0.000102 0.000580 0.141727 ( 1.198796) | |
| PromiseKit 0.000084 0.000533 0.072695 ( 0.633645) | |
| Moya 0.000085 0.000563 0.085157 ( 0.674803) | |
| CocoaAsyncSocket 0.000087 0.000538 0.102473 ( 0.737209) | |
| Eureka 0.000090 0.000554 0.400073 ( 1.611943) | |
| folding-cell 0.000090 0.000541 0.324667 ( 2.043012) | |
| NVActivityIndicatorView 0.000104 0.000549 0.088304 ( 0.630883) | |
| SkeletonView 0.000083 0.000536 0.103810 ( 0.706556) | |
| Quick 0.000084 0.000534 0.088923 ( 0.852848) | |
| SwifterSwift 0.000087 0.000551 0.232277 ( 1.370784) | |
| ObjectMapper 0.000085 0.000532 0.105336 ( 0.671433) | |
| IBAnimatable 0.000084 0.000544 0.202773 ( 1.123856) | |
| CryptoSwift 0.000079 0.000555 0.074655 ( 0.719163) | |
| swift-package-manager 0.000082 0.000546 0.220772 ( 1.057774) | |
| R.swift 0.000087 0.000575 0.128693 ( 0.838331) | |
| PureLayout 0.000089 0.000571 0.070046 ( 0.621298) | |
| Kitura 0.000086 0.000550 0.113094 ( 0.813256) | |
| Cartography 0.000085 0.000542 0.125957 ( 0.660371) | |
| SQLite.swift 0.000085 0.000540 0.068487 ( 0.618180) | |
| Reachability.swift 0.000083 0.000540 0.085587 ( 0.559912) | |
| JTAppleCalendar 0.000083 0.000531 0.109751 ( 0.794185) | |
| ReSwift 0.000087 0.000694 0.093764 ( 0.679971) | |
| facebook-ios-sdk 0.000090 0.000547 0.280746 ( 1.594408) | |
| SwiftGen 0.000082 0.000524 0.416917 ( 2.401701) | |
| Starscream 0.000085 0.000553 0.060371 ( 0.638762) | |
| swift-nio 0.000086 0.000537 0.133366 ( 1.033090) | |
| ViewAnimator 0.000086 0.000558 0.181537 ( 1.091609) | |
| SwiftDate 0.000091 0.000589 0.094182 ( 0.739587) | |
| KeychainAccess 0.000097 0.000566 0.073815 ( 0.635560) | |
| Macaw 0.000084 0.000525 0.121431 ( 0.672766) | |
| SwipeCellKit 0.000085 0.000527 0.171877 ( 0.888319) | |
| Nuke 0.000086 0.000547 0.096800 ( 0.702987) | |
| SwiftyStoreKit 0.000087 0.000535 0.078165 ( 0.649689) | |
| SwiftyBeaver 0.000101 0.000731 0.080998 ( 0.603176) | |
| SwiftEntryKit 0.000085 0.000556 0.123608 ( 0.810066) | |
| curl + unzip | |
| ------------ | |
| user system total real | |
| Alamofire 0.000083 0.000578 0.047543 ( 0.438428) | |
| Charts 0.000085 0.000475 0.073209 ( 0.673222) | |
| SDWebImage 0.000085 0.000493 0.070839 ( 0.963911) | |
| ReactiveCocoa 0.000085 0.000486 0.034548 ( 0.519555) | |
| lottie-ios 0.000082 0.000471 0.121803 ( 1.087244) | |
| SwiftyJSON 0.000081 0.000483 0.028744 ( 0.588119) | |
| vapor 0.000093 0.000507 0.031894 ( 0.657963) | |
| RxSwift 0.000082 0.000492 0.041618 ( 0.788529) | |
| Hero 0.000096 0.000509 0.249148 ( 1.531092) | |
| SnapKit 0.000097 0.000492 0.028509 ( 0.394953) | |
| Kingfisher 0.000081 0.000472 0.055677 ( 0.929202) | |
| MBProgressHUD 0.000085 0.000482 0.035029 ( 0.642001) | |
| IQKeyboardManager 0.000081 0.000480 0.052291 ( 0.749722) | |
| realm-cocoa 0.000083 0.000476 0.049941 ( 0.672720) | |
| Carthage 0.000080 0.000504 0.105637 ( 1.503029) | |
| SwiftLint 0.000080 0.000497 0.039125 ( 0.636095) | |
| PromiseKit 0.000080 0.000476 0.030474 ( 0.447122) | |
| Moya 0.000079 0.000500 0.033000 ( 0.475439) | |
| CocoaAsyncSocket 0.000079 0.000500 0.036218 ( 0.640219) | |
| Eureka 0.000082 0.000500 0.138553 ( 1.383653) | |
| folding-cell 0.000124 0.000514 0.161265 ( 2.136727) | |
| NVActivityIndicatorView 0.000095 0.000522 0.038232 ( 0.561053) | |
| SkeletonView 0.000083 0.000507 0.049915 ( 0.623630) | |
| Quick 0.000084 0.000566 0.039729 ( 0.498851) | |
| SwifterSwift 0.000080 0.000518 0.066981 ( 1.434170) | |
| ObjectMapper 0.000080 0.000496 0.028871 ( 0.523576) | |
| IBAnimatable 0.000078 0.000479 0.081879 ( 1.143258) | |
| CryptoSwift 0.000081 0.000529 0.031622 ( 0.535472) | |
| swift-package-manager 0.000077 0.000480 0.040918 ( 0.593177) | |
| R.swift 0.000079 0.000483 0.047464 ( 0.541360) | |
| PureLayout 0.000079 0.000480 0.031533 ( 0.661279) | |
| Kitura 0.000084 0.000532 0.041489 ( 0.598221) | |
| Cartography 0.000081 0.000472 0.037126 ( 0.585534) | |
| SQLite.swift 0.000079 0.000483 0.033331 ( 0.591542) | |
| Reachability.swift 0.000079 0.000498 0.028668 ( 0.518653) | |
| JTAppleCalendar 0.000081 0.000517 0.027403 ( 0.464183) | |
| ReSwift 0.000095 0.000546 0.043128 ( 0.653240) | |
| facebook-ios-sdk 0.000079 0.000481 0.080229 ( 1.435391) | |
| SwiftGen 0.000110 0.000488 0.066499 ( 2.195309) | |
| Starscream 0.000094 0.000525 0.029585 ( 0.442313) | |
| swift-nio 0.000081 0.000515 0.041171 ( 0.601788) | |
| ViewAnimator 0.000083 0.000513 0.109572 ( 0.990973) | |
| SwiftDate 0.000080 0.000490 0.037179 ( 0.527112) | |
| KeychainAccess 0.000080 0.000516 0.034888 ( 0.501061) | |
| Macaw 0.000083 0.000501 0.037454 ( 0.574375) | |
| SwipeCellKit 0.000080 0.000518 0.079586 ( 0.855079) | |
| Nuke 0.000080 0.000488 0.044444 ( 0.539984) | |
| SwiftyStoreKit 0.000078 0.000497 0.037934 ( 0.585002) | |
| SwiftyBeaver 0.000079 0.000503 0.028810 ( 0.484051) | |
| SwiftEntryKit 0.000080 0.000510 0.039134 ( 0.602307) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VERY similar iMac (although mine escaped the Dark Mode infection), network is worse - joined 350/35 & 80/20 giving about 100-200Mbps at the desktop.
Results: https://gist.github.com/richardgroves/e6fc682b94978cf161e1218e340b03e2