{"action":"created","comment":{"url":"https://api.github.com/repos/v0dro/daru/pulls/comments/41597555","id":41597555,"diff_hunk":"@@ -906,19 +906,19 @@ def filter_vector vec\n     def filter_rows &block\n       return to_enum(:filter_rows) unless block_given?\n \n-      df = Daru::DataFrame.new({}, order: @vectors.to_a)\n-      marked = []\n-\n-      @index.each do |index|\n-        keep_row = yield access_row(index)\n-        marked << index if keep_row\n-      end\n-\n-      marked.each do |idx|\n-        df.row[idx] = self[idx, :row]\n+      values = to_a[0].map{|h| h.values}","path":"lib/daru/dataframe.rb","position":14,"original_position":14,"commit_id":"fbb17c6d5395aaf376f760cc0055198298bd45c3","original_commit_id":"fbb17c6d5395aaf376f760cc0055198298bd45c3","user":{"login":"v0dro","id":2629909,"avatar_url":"https://avatars.githubusercontent.com/u/2629909?v=3","gravatar_id":"","url":"https://api.github.com/users/v0dro","html_url":"https://github.com/v0dro","followers_url":"https://api.github.com/users/v0dro/followers","following_url":"https://api.github.com/users/v0dro/following{/other_user}","gists_url":"https://api.github.com/users/v0dro/gists{/gist_id}","starred_url":"https://api.github.com/users/v0dro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v0dro/subscriptions","organizations_url":"https://api.github.com/users/v0dro/orgs","repos_url":"https://api.github.com/users/v0dro/repos","events_url":"https://api.github.com/users/v0dro/events{/privacy}","received_events_url":"https://api.github.com/users/v0dro/received_events","type":"User","site_admin":false},"body":"Could you try `self.to_matrix.to_a` to get rows in an Array of Arrays and see if it's faster? I have a hunch it might be.","created_at":"2015-10-09T04:57:45Z","updated_at":"2015-10-09T04:57:45Z","html_url":"https://github.com/v0dro/daru/pull/25#discussion_r41597555","pull_request_url":"https://api.github.com/repos/v0dro/daru/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/v0dro/daru/pulls/comments/41597555"},"html":{"href":"https://github.com/v0dro/daru/pull/25#discussion_r41597555"},"pull_request":{"href":"https://api.github.com/repos/v0dro/daru/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/v0dro/daru/pulls/25","id":46854134,"html_url":"https://github.com/v0dro/daru/pull/25","diff_url":"https://github.com/v0dro/daru/pull/25.diff","patch_url":"https://github.com/v0dro/daru/pull/25.patch","issue_url":"https://api.github.com/repos/v0dro/daru/issues/25","number":25,"state":"open","locked":false,"title":"faster filter_row implementation","user":{"login":"peterktung","id":5607838,"avatar_url":"https://avatars.githubusercontent.com/u/5607838?v=3","gravatar_id":"","url":"https://api.github.com/users/peterktung","html_url":"https://github.com/peterktung","followers_url":"https://api.github.com/users/peterktung/followers","following_url":"https://api.github.com/users/peterktung/following{/other_user}","gists_url":"https://api.github.com/users/peterktung/gists{/gist_id}","starred_url":"https://api.github.com/users/peterktung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterktung/subscriptions","organizations_url":"https://api.github.com/users/peterktung/orgs","repos_url":"https://api.github.com/users/peterktung/repos","events_url":"https://api.github.com/users/peterktung/events{/privacy}","received_events_url":"https://api.github.com/users/peterktung/received_events","type":"User","site_admin":false},"body":"Benchmark code here: https://gist.github.com/peterktung/f60f83d7ec9d6e84fe71\r\n```\r\nBefore:\r\nRehearsal --------------------------------------------------------\r\nfilter_row:           98.750000   1.090000  99.840000 ( 99.890700)\r\n---------------------------------------------- total: 99.840000sec\r\n\r\n                           user     system      total        real\r\nfilter_row:           98.130000   1.120000  99.250000 ( 99.311869)\r\n\r\nAfter:\r\nRehearsal --------------------------------------------------------\r\nfilter_row:            2.180000   0.010000   2.190000 (  2.192253)\r\n----------------------------------------------- total: 2.190000sec\r\n\r\n                           user     system      total        real\r\nfilter_row:            2.180000   0.010000   2.190000 (  2.187111)\r\n```","created_at":"2015-10-06T01:32:39Z","updated_at":"2015-10-09T04:57:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"79fb8248c65af4266177030375b68c68739a3e0d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/v0dro/daru/pulls/25/commits","review_comments_url":"https://api.github.com/repos/v0dro/daru/pulls/25/comments","review_comment_url":"https://api.github.com/repos/v0dro/daru/pulls/comments{/number}","comments_url":"https://api.github.com/repos/v0dro/daru/issues/25/comments","statuses_url":"https://api.github.com/repos/v0dro/daru/statuses/fbb17c6d5395aaf376f760cc0055198298bd45c3","head":{"label":"peterktung:faster_row_filter","ref":"faster_row_filter","sha":"fbb17c6d5395aaf376f760cc0055198298bd45c3","user":{"login":"peterktung","id":5607838,"avatar_url":"https://avatars.githubusercontent.com/u/5607838?v=3","gravatar_id":"","url":"https://api.github.com/users/peterktung","html_url":"https://github.com/peterktung","followers_url":"https://api.github.com/users/peterktung/followers","following_url":"https://api.github.com/users/peterktung/following{/other_user}","gists_url":"https://api.github.com/users/peterktung/gists{/gist_id}","starred_url":"https://api.github.com/users/peterktung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterktung/subscriptions","organizations_url":"https://api.github.com/users/peterktung/orgs","repos_url":"https://api.github.com/users/peterktung/repos","events_url":"https://api.github.com/users/peterktung/events{/privacy}","received_events_url":"https://api.github.com/users/peterktung/received_events","type":"User","site_admin":false},"repo":{"id":42269457,"name":"daru","full_name":"peterktung/daru","owner":{"login":"peterktung","id":5607838,"avatar_url":"https://avatars.githubusercontent.com/u/5607838?v=3","gravatar_id":"","url":"https://api.github.com/users/peterktung","html_url":"https://github.com/peterktung","followers_url":"https://api.github.com/users/peterktung/followers","following_url":"https://api.github.com/users/peterktung/following{/other_user}","gists_url":"https://api.github.com/users/peterktung/gists{/gist_id}","starred_url":"https://api.github.com/users/peterktung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterktung/subscriptions","organizations_url":"https://api.github.com/users/peterktung/orgs","repos_url":"https://api.github.com/users/peterktung/repos","events_url":"https://api.github.com/users/peterktung/events{/privacy}","received_events_url":"https://api.github.com/users/peterktung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peterktung/daru","description":"Data Analysis in RUby","fork":true,"url":"https://api.github.com/repos/peterktung/daru","forks_url":"https://api.github.com/repos/peterktung/daru/forks","keys_url":"https://api.github.com/repos/peterktung/daru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterktung/daru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterktung/daru/teams","hooks_url":"https://api.github.com/repos/peterktung/daru/hooks","issue_events_url":"https://api.github.com/repos/peterktung/daru/issues/events{/number}","events_url":"https://api.github.com/repos/peterktung/daru/events","assignees_url":"https://api.github.com/repos/peterktung/daru/assignees{/user}","branches_url":"https://api.github.com/repos/peterktung/daru/branches{/branch}","tags_url":"https://api.github.com/repos/peterktung/daru/tags","blobs_url":"https://api.github.com/repos/peterktung/daru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterktung/daru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterktung/daru/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterktung/daru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterktung/daru/statuses/{sha}","languages_url":"https://api.github.com/repos/peterktung/daru/languages","stargazers_url":"https://api.github.com/repos/peterktung/daru/stargazers","contributors_url":"https://api.github.com/repos/peterktung/daru/contributors","subscribers_url":"https://api.github.com/repos/peterktung/daru/subscribers","subscription_url":"https://api.github.com/repos/peterktung/daru/subscription","commits_url":"https://api.github.com/repos/peterktung/daru/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterktung/daru/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterktung/daru/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterktung/daru/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterktung/daru/contents/{+path}","compare_url":"https://api.github.com/repos/peterktung/daru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterktung/daru/merges","archive_url":"https://api.github.com/repos/peterktung/daru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterktung/daru/downloads","issues_url":"https://api.github.com/repos/peterktung/daru/issues{/number}","pulls_url":"https://api.github.com/repos/peterktung/daru/pulls{/number}","milestones_url":"https://api.github.com/repos/peterktung/daru/milestones{/number}","notifications_url":"https://api.github.com/repos/peterktung/daru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterktung/daru/labels{/name}","releases_url":"https://api.github.com/repos/peterktung/daru/releases{/id}","created_at":"2015-09-10T20:37:51Z","updated_at":"2015-09-10T20:37:52Z","pushed_at":"2015-10-06T01:29:12Z","git_url":"git://github.com/peterktung/daru.git","ssh_url":"git@github.com:peterktung/daru.git","clone_url":"https://github.com/peterktung/daru.git","svn_url":"https://github.com/peterktung/daru","homepage":null,"size":2690,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"v0dro:master","ref":"master","sha":"e587a5823a3dc859541dbd377c1b95d1e7bc5117","user":{"login":"v0dro","id":2629909,"avatar_url":"https://avatars.githubusercontent.com/u/2629909?v=3","gravatar_id":"","url":"https://api.github.com/users/v0dro","html_url":"https://github.com/v0dro","followers_url":"https://api.github.com/users/v0dro/followers","following_url":"https://api.github.com/users/v0dro/following{/other_user}","gists_url":"https://api.github.com/users/v0dro/gists{/gist_id}","starred_url":"https://api.github.com/users/v0dro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v0dro/subscriptions","organizations_url":"https://api.github.com/users/v0dro/orgs","repos_url":"https://api.github.com/users/v0dro/repos","events_url":"https://api.github.com/users/v0dro/events{/privacy}","received_events_url":"https://api.github.com/users/v0dro/received_events","type":"User","site_admin":false},"repo":{"id":24784998,"name":"daru","full_name":"v0dro/daru","owner":{"login":"v0dro","id":2629909,"avatar_url":"https://avatars.githubusercontent.com/u/2629909?v=3","gravatar_id":"","url":"https://api.github.com/users/v0dro","html_url":"https://github.com/v0dro","followers_url":"https://api.github.com/users/v0dro/followers","following_url":"https://api.github.com/users/v0dro/following{/other_user}","gists_url":"https://api.github.com/users/v0dro/gists{/gist_id}","starred_url":"https://api.github.com/users/v0dro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v0dro/subscriptions","organizations_url":"https://api.github.com/users/v0dro/orgs","repos_url":"https://api.github.com/users/v0dro/repos","events_url":"https://api.github.com/users/v0dro/events{/privacy}","received_events_url":"https://api.github.com/users/v0dro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/v0dro/daru","description":"Data Analysis in RUby","fork":false,"url":"https://api.github.com/repos/v0dro/daru","forks_url":"https://api.github.com/repos/v0dro/daru/forks","keys_url":"https://api.github.com/repos/v0dro/daru/keys{/key_id}","collaborators_url":"https://api.github.com/repos/v0dro/daru/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/v0dro/daru/teams","hooks_url":"https://api.github.com/repos/v0dro/daru/hooks","issue_events_url":"https://api.github.com/repos/v0dro/daru/issues/events{/number}","events_url":"https://api.github.com/repos/v0dro/daru/events","assignees_url":"https://api.github.com/repos/v0dro/daru/assignees{/user}","branches_url":"https://api.github.com/repos/v0dro/daru/branches{/branch}","tags_url":"https://api.github.com/repos/v0dro/daru/tags","blobs_url":"https://api.github.com/repos/v0dro/daru/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/v0dro/daru/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/v0dro/daru/git/refs{/sha}","trees_url":"https://api.github.com/repos/v0dro/daru/git/trees{/sha}","statuses_url":"https://api.github.com/repos/v0dro/daru/statuses/{sha}","languages_url":"https://api.github.com/repos/v0dro/daru/languages","stargazers_url":"https://api.github.com/repos/v0dro/daru/stargazers","contributors_url":"https://api.github.com/repos/v0dro/daru/contributors","subscribers_url":"https://api.github.com/repos/v0dro/daru/subscribers","subscription_url":"https://api.github.com/repos/v0dro/daru/subscription","commits_url":"https://api.github.com/repos/v0dro/daru/commits{/sha}","git_commits_url":"https://api.github.com/repos/v0dro/daru/git/commits{/sha}","comments_url":"https://api.github.com/repos/v0dro/daru/comments{/number}","issue_comment_url":"https://api.github.com/repos/v0dro/daru/issues/comments{/number}","contents_url":"https://api.github.com/repos/v0dro/daru/contents/{+path}","compare_url":"https://api.github.com/repos/v0dro/daru/compare/{base}...{head}","merges_url":"https://api.github.com/repos/v0dro/daru/merges","archive_url":"https://api.github.com/repos/v0dro/daru/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/v0dro/daru/downloads","issues_url":"https://api.github.com/repos/v0dro/daru/issues{/number}","pulls_url":"https://api.github.com/repos/v0dro/daru/pulls{/number}","milestones_url":"https://api.github.com/repos/v0dro/daru/milestones{/number}","notifications_url":"https://api.github.com/repos/v0dro/daru/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/v0dro/daru/labels{/name}","releases_url":"https://api.github.com/repos/v0dro/daru/releases{/id}","created_at":"2014-10-04T08:23:21Z","updated_at":"2015-10-09T04:56:09Z","pushed_at":"2015-10-06T01:32:40Z","git_url":"git://github.com/v0dro/daru.git","ssh_url":"git@github.com:v0dro/daru.git","clone_url":"https://github.com/v0dro/daru.git","svn_url":"https://github.com/v0dro/daru","homepage":null,"size":3327,"stargazers_count":38,"watchers_count":38,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":4,"forks":7,"open_issues":4,"watchers":38,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/v0dro/daru/pulls/25"},"html":{"href":"https://github.com/v0dro/daru/pull/25"},"issue":{"href":"https://api.github.com/repos/v0dro/daru/issues/25"},"comments":{"href":"https://api.github.com/repos/v0dro/daru/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/v0dro/daru/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/v0dro/daru/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/v0dro/daru/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/v0dro/daru/statuses/fbb17c6d5395aaf376f760cc0055198298bd45c3"}}}}