{"id":26175,"date":"2019-08-05T16:45:57","date_gmt":"2019-08-05T20:45:57","guid":{"rendered":"https:\/\/mjtsai.com\/blog\/?p=26175"},"modified":"2019-08-06T15:33:27","modified_gmt":"2019-08-06T19:33:27","slug":"performance-of-combine","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2019\/08\/05\/performance-of-combine\/","title":{"rendered":"Performance of Combine"},"content":{"rendered":"<p><a href=\"https:\/\/github.com\/quickbirdstudios\/CombineRxSwiftPerformance\">quickbirdstudios<\/a> (via <a href=\"https:\/\/twitter.com\/steipete\/status\/1158451654641049600\">Peter Steinberger<\/a>):<\/p>\n<blockquote cite=\"https:\/\/github.com\/quickbirdstudios\/CombineRxSwiftPerformance\"><p>This project contains a benchmarking test suite for comparing the performance of the most commonly used components and operators in RxSwift and Combine. For a detailed comparison of RxSwift with Combine have a look at <a href=\"https:\/\/quickbirdstudios.com\/blog\/?p=831\">our blog post<\/a>.<\/p><p>[&#8230;]<\/p><p>As a summary Combine was faster in every test and on average 4,5x more performant than RxSwift.<\/p><\/blockquote>\n<p>You can also use the two <a href=\"https:\/\/github.com\/quickbirdstudios\/CombineRxSwiftPerformance\/blob\/master\/SpeedTestTests\/RxSwiftTests.swift\">test<\/a> <a href=\"https:\/\/github.com\/quickbirdstudios\/CombineRxSwiftPerformance\/blob\/master\/SpeedTestTests\/CombineTests.swift\">files<\/a> as a Rosetta stone.<\/p>\n\n<p>Previously:<\/p>\n<ul>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/07\/01\/using-combine\/\">Using Combine<\/a><\/li>\n<li><a href=\"https:\/\/mjtsai.com\/blog\/2019\/06\/03\/swiftui-and-combine\/\">SwiftUI and Combine<\/a><\/li>\n<\/ul>\n\n<p id=\"performance-of-combine-update-2019-08-06\">Update (2019-08-06): <a href=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158557577413685248\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158557577413685248\">\n<p>The numbers on that page are generated in <em>Debug<\/em> builds.<\/p>\n<p>I&rsquo;m disappointed that people are repeating values so uncritically. Built in Release, those tests show Combine to be slightly faster than RxSwift but not by much.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158607065113231360\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158607065113231360\">\n<p>The biggest change I would suggest for most of the tests is to put the Publisher\/Subscribe\/Cancel <em>outside<\/em> the <code>measure<\/code> closure. These can be expensive but are done only once so only matter in specific scenarios.<\/p>\n<\/blockquote>\n\n<p><a href=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158558912947220480\">Matt Gallagher<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/cocoawithlove\/status\/1158558912947220480\">\n<p>Reactive programming frameworks have different specialities. I have test cases where RxSwift is 3 times faster. I have test cases where Combine is 5 times faster.<\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>quickbirdstudios (via Peter Steinberger): This project contains a benchmarking test suite for comparing the performance of the most commonly used components and operators in RxSwift and Combine. For a detailed comparison of RxSwift with Combine have a look at our blog post.[&#8230;]As a summary Combine was faster in every test and on average 4,5x more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"apple_news_api_created_at":"2019-08-05T20:46:00Z","apple_news_api_id":"8141cf38-cd05-464d-a621-51a0beb78f26","apple_news_api_modified_at":"2019-08-06T19:33:31Z","apple_news_api_revision":"AAAAAAAAAAAAAAAAAAAAAA==","apple_news_api_share_url":"https:\/\/apple.news\/AgUHPOM0FRk2mIVGgvrePJg","apple_news_coverimage":0,"apple_news_coverimage_caption":"","apple_news_is_hidden":false,"apple_news_is_paid":false,"apple_news_is_preview":false,"apple_news_is_sponsored":false,"apple_news_maturity_rating":"","apple_news_metadata":"\"\"","apple_news_pullquote":"","apple_news_pullquote_position":"","apple_news_slug":"","apple_news_sections":"\"\"","apple_news_suppress_video_url":false,"apple_news_use_image_component":false,"footnotes":""},"categories":[4],"tags":[1813,30,1666,71,341,901],"class_list":["post-26175","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-combine-framework","tag-mac","tag-macos-10-15","tag-programming","tag-reactivecocoa","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/comments?post=26175"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26175\/revisions"}],"predecessor-version":[{"id":26188,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/26175\/revisions\/26188"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=26175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=26175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=26175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}