{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1721","repository_url":"https://api.github.com/repos/ReactiveX/rxjs","labels_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1721/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1721/comments","events_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1721/events","html_url":"https://github.com/ReactiveX/rxjs/issues/1721","id":156097361,"number":1721,"title":"flatMap performance","user":{"login":"cortopy","id":8725825,"avatar_url":"https://avatars.githubusercontent.com/u/8725825?v=3","gravatar_id":"","url":"https://api.github.com/users/cortopy","html_url":"https://github.com/cortopy","followers_url":"https://api.github.com/users/cortopy/followers","following_url":"https://api.github.com/users/cortopy/following{/other_user}","gists_url":"https://api.github.com/users/cortopy/gists{/gist_id}","starred_url":"https://api.github.com/users/cortopy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cortopy/subscriptions","organizations_url":"https://api.github.com/users/cortopy/orgs","repos_url":"https://api.github.com/users/cortopy/repos","events_url":"https://api.github.com/users/cortopy/events{/privacy}","received_events_url":"https://api.github.com/users/cortopy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-21T11:30:30Z","updated_at":"2016-05-22T01:41:21Z","closed_at":null,"body":"The following filtering of an ObservableArray is extremely slow and resource hungry:\r\n\r\n```JS\r\nmyobserver\r\n  .flatMap(el => {return el; })\r\n  .filter(el => {return !el.property; })\r\n  .subscribe(validEl => {\r\n    console.log(validEl);\r\n  });\r\n```\r\nHowever, this isn't:\r\n\r\n```JS\r\nmyobserver\r\n  .subscribe(arr => {\r\n    let filteredArr = arr.filter(el => { return !el.property; });\r\n    console.log(filteredArr);\r\n  });\r\n```\r\n\r\nA quick look at my laptop resources shows that the former takes CPU usage over the roof. Having tried different variations this only happens when I use the `flatMap` operator. `switchMap` has same results. I'm puzzled about this as the array's length is only 300\r\n\r\n`myobserver` is an ObservableR returned by a BehaviourSubjectT\r\n\r\nissue wrongly originally reported as https://github.com/Reactive-Extensions/RxJS/issues/1238"},"comment":{"url":"https://api.github.com/repos/ReactiveX/rxjs/issues/comments/220809629","html_url":"https://github.com/ReactiveX/rxjs/issues/1721#issuecomment-220809629","issue_url":"https://api.github.com/repos/ReactiveX/rxjs/issues/1721","id":220809629,"user":{"login":"trxcllnt","id":178183,"avatar_url":"https://avatars.githubusercontent.com/u/178183?v=3","gravatar_id":"","url":"https://api.github.com/users/trxcllnt","html_url":"https://github.com/trxcllnt","followers_url":"https://api.github.com/users/trxcllnt/followers","following_url":"https://api.github.com/users/trxcllnt/following{/other_user}","gists_url":"https://api.github.com/users/trxcllnt/gists{/gist_id}","starred_url":"https://api.github.com/users/trxcllnt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trxcllnt/subscriptions","organizations_url":"https://api.github.com/users/trxcllnt/orgs","repos_url":"https://api.github.com/users/trxcllnt/repos","events_url":"https://api.github.com/users/trxcllnt/events{/privacy}","received_events_url":"https://api.github.com/users/trxcllnt/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T01:41:21Z","updated_at":"2016-05-22T01:41:21Z","body":"@cortopy could you provide more information to reproduce this behavior (sample data, etc.), or maybe a PR with a new [performance test](https://github.com/ReactiveX/rxjs/tree/master/perf/micro)? I can't replicate your issue."}}
{"actor":{"display_login":"trxcllnt"}}