{"id":12066,"date":"2015-08-22T09:31:05","date_gmt":"2015-08-22T13:31:05","guid":{"rendered":"http:\/\/mjtsai.com\/blog\/?p=12066"},"modified":"2015-08-22T09:32:27","modified_gmt":"2015-08-22T13:32:27","slug":"lazy-filters-and-maps","status":"publish","type":"post","link":"https:\/\/mjtsai.com\/blog\/2015\/08\/22\/lazy-filters-and-maps\/","title":{"rendered":"Lazy Filters and Maps"},"content":{"rendered":"<p><a href=\"http:\/\/owensd.io\/2015\/08\/09\/filter-performance.html\">David Owens II<\/a>:<\/p>\n<blockquote cite=\"http:\/\/owensd.io\/2015\/08\/09\/filter-performance.html\">\n<p>Simply wrapping <code>items<\/code> in a <code>lazy()<\/code> call will convert our <code>Sequence<\/code> into a <code>LazySequence<\/code>. This gives us the performance benefits of the more iterative-style approach with the benefits of the semantically broken out operations.<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/jckarter\/status\/633297147065077760\">Joe Groff<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/jckarter\/status\/633297147065077760\"><p>map and filter produce copies which are likely cause of slowdown. lazy().map and filter should be as fast as loops.<\/p><\/blockquote>\n<p><a href=\"https:\/\/twitter.com\/krzyzanowskim\/status\/633317270425575429\">Marcin Krzyzanowski<\/a>:<\/p>\n<blockquote cite=\"https:\/\/twitter.com\/krzyzanowskim\/status\/633317270425575429\"><p>I believe you, but I&rsquo;m looking at map vs for-loop code in the very moment where loop is many times faster than lazy map.<\/p><\/blockquote>","protected":false},"excerpt":{"rendered":"<p>David Owens II: Simply wrapping items in a lazy() call will convert our Sequence into a LazySequence. This gives us the performance benefits of the more iterative-style approach with the benefits of the semantically broken out operations. Joe Groff: map and filter produce copies which are likely cause of slowdown. lazy().map and filter should be [&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":"","apple_news_api_id":"","apple_news_api_modified_at":"","apple_news_api_revision":"","apple_news_api_share_url":"","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":[46,138,71,901],"class_list":["post-12066","post","type-post","status-publish","format-standard","hentry","category-programming-category","tag-languagedesign","tag-optimization","tag-programming","tag-swift-programming-language"],"apple_news_notices":[],"_links":{"self":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12066","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=12066"}],"version-history":[{"count":2,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12066\/revisions"}],"predecessor-version":[{"id":12072,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/posts\/12066\/revisions\/12072"}],"wp:attachment":[{"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/media?parent=12066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/categories?post=12066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mjtsai.com\/blog\/wp-json\/wp\/v2\/tags?post=12066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}