{"action":"created","comment":{"url":"https://api.github.com/repos/witgo/spark/pulls/comments/29572422","id":29572422,"diff_hunk":"@@ -351,7 +351,14 @@ object LDA {\n     val nweGraph = graph.mapTriplets(\n       (pid, iter) => {\n         val gen = new XORShiftRandom(parts * innerIter + pid)\n-        val wordTableCache = new AppendOnlyMap[VertexId, SoftReference[(Double, Table)]]()\n+        // table is a per term data structure\n+        // in GraphX, edges in a partition are clustered by source IDs (term id in this case)\n+        // so, use below simple cache to avoid calculating table each time\n+        val lastTable = (new ArrayBuffer[Int](numTopics.toInt),\n+                         new ArrayBuffer[Int](numTopics.toInt),","path":"mllib/src/main/scala/org/apache/spark/mllib/clustering/LDA.scala","position":32,"original_position":32,"commit_id":"e7bce416f16d878694fd8338a865971dcbab4d72","original_commit_id":"e7bce416f16d878694fd8338a865971dcbab4d72","user":{"login":"haow1990","id":1690198,"avatar_url":"https://avatars.githubusercontent.com/u/1690198?v=3","gravatar_id":"","url":"https://api.github.com/users/haow1990","html_url":"https://github.com/haow1990","followers_url":"https://api.github.com/users/haow1990/followers","following_url":"https://api.github.com/users/haow1990/following{/other_user}","gists_url":"https://api.github.com/users/haow1990/gists{/gist_id}","starred_url":"https://api.github.com/users/haow1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haow1990/subscriptions","organizations_url":"https://api.github.com/users/haow1990/orgs","repos_url":"https://api.github.com/users/haow1990/repos","events_url":"https://api.github.com/users/haow1990/events{/privacy}","received_events_url":"https://api.github.com/users/haow1990/received_events","type":"User","site_admin":false},"body":"Do you mean that using ArrayBuffer is inappropriate here? Could you please be more specific?","created_at":"2015-05-04T08:50:11Z","updated_at":"2015-05-04T08:50:11Z","html_url":"https://github.com/witgo/spark/pull/1#discussion_r29572422","pull_request_url":"https://api.github.com/repos/witgo/spark/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/witgo/spark/pulls/comments/29572422"},"html":{"href":"https://github.com/witgo/spark/pull/1#discussion_r29572422"},"pull_request":{"href":"https://api.github.com/repos/witgo/spark/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/witgo/spark/pulls/1","id":34617574,"html_url":"https://github.com/witgo/spark/pull/1","diff_url":"https://github.com/witgo/spark/pull/1.diff","patch_url":"https://github.com/witgo/spark/pull/1.patch","issue_url":"https://api.github.com/repos/witgo/spark/issues/1","number":1,"state":"open","locked":false,"title":"remove word table cache","user":{"login":"haow1990","id":1690198,"avatar_url":"https://avatars.githubusercontent.com/u/1690198?v=3","gravatar_id":"","url":"https://api.github.com/users/haow1990","html_url":"https://github.com/haow1990","followers_url":"https://api.github.com/users/haow1990/followers","following_url":"https://api.github.com/users/haow1990/following{/other_user}","gists_url":"https://api.github.com/users/haow1990/gists{/gist_id}","starred_url":"https://api.github.com/users/haow1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haow1990/subscriptions","organizations_url":"https://api.github.com/users/haow1990/orgs","repos_url":"https://api.github.com/users/haow1990/repos","events_url":"https://api.github.com/users/haow1990/events{/privacy}","received_events_url":"https://api.github.com/users/haow1990/received_events","type":"User","site_admin":false},"body":"In LDA.sampleTokens, there was a table cache for terms (AppendOnlyMap[Vid, SoftReference[Table]]), it's not necessary  in that edges in GraphX are clustered by source ids (term id in this case). A simple table cache does all the magic.","created_at":"2015-05-04T06:25:04Z","updated_at":"2015-05-04T08:50:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"43035994b1cd0f5b391fafbf3c8553b844a38063","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/witgo/spark/pulls/1/commits","review_comments_url":"https://api.github.com/repos/witgo/spark/pulls/1/comments","review_comment_url":"https://api.github.com/repos/witgo/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/witgo/spark/issues/1/comments","statuses_url":"https://api.github.com/repos/witgo/spark/statuses/e7bce416f16d878694fd8338a865971dcbab4d72","head":{"label":"haow1990:ldaGibbs/NoWordTableCache","ref":"ldaGibbs/NoWordTableCache","sha":"e7bce416f16d878694fd8338a865971dcbab4d72","user":{"login":"haow1990","id":1690198,"avatar_url":"https://avatars.githubusercontent.com/u/1690198?v=3","gravatar_id":"","url":"https://api.github.com/users/haow1990","html_url":"https://github.com/haow1990","followers_url":"https://api.github.com/users/haow1990/followers","following_url":"https://api.github.com/users/haow1990/following{/other_user}","gists_url":"https://api.github.com/users/haow1990/gists{/gist_id}","starred_url":"https://api.github.com/users/haow1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haow1990/subscriptions","organizations_url":"https://api.github.com/users/haow1990/orgs","repos_url":"https://api.github.com/users/haow1990/repos","events_url":"https://api.github.com/users/haow1990/events{/privacy}","received_events_url":"https://api.github.com/users/haow1990/received_events","type":"User","site_admin":false},"repo":{"id":30278138,"name":"spark","full_name":"haow1990/spark","owner":{"login":"haow1990","id":1690198,"avatar_url":"https://avatars.githubusercontent.com/u/1690198?v=3","gravatar_id":"","url":"https://api.github.com/users/haow1990","html_url":"https://github.com/haow1990","followers_url":"https://api.github.com/users/haow1990/followers","following_url":"https://api.github.com/users/haow1990/following{/other_user}","gists_url":"https://api.github.com/users/haow1990/gists{/gist_id}","starred_url":"https://api.github.com/users/haow1990/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haow1990/subscriptions","organizations_url":"https://api.github.com/users/haow1990/orgs","repos_url":"https://api.github.com/users/haow1990/repos","events_url":"https://api.github.com/users/haow1990/events{/privacy}","received_events_url":"https://api.github.com/users/haow1990/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haow1990/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/haow1990/spark","forks_url":"https://api.github.com/repos/haow1990/spark/forks","keys_url":"https://api.github.com/repos/haow1990/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haow1990/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haow1990/spark/teams","hooks_url":"https://api.github.com/repos/haow1990/spark/hooks","issue_events_url":"https://api.github.com/repos/haow1990/spark/issues/events{/number}","events_url":"https://api.github.com/repos/haow1990/spark/events","assignees_url":"https://api.github.com/repos/haow1990/spark/assignees{/user}","branches_url":"https://api.github.com/repos/haow1990/spark/branches{/branch}","tags_url":"https://api.github.com/repos/haow1990/spark/tags","blobs_url":"https://api.github.com/repos/haow1990/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haow1990/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haow1990/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/haow1990/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haow1990/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/haow1990/spark/languages","stargazers_url":"https://api.github.com/repos/haow1990/spark/stargazers","contributors_url":"https://api.github.com/repos/haow1990/spark/contributors","subscribers_url":"https://api.github.com/repos/haow1990/spark/subscribers","subscription_url":"https://api.github.com/repos/haow1990/spark/subscription","commits_url":"https://api.github.com/repos/haow1990/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/haow1990/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/haow1990/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/haow1990/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/haow1990/spark/contents/{+path}","compare_url":"https://api.github.com/repos/haow1990/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haow1990/spark/merges","archive_url":"https://api.github.com/repos/haow1990/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haow1990/spark/downloads","issues_url":"https://api.github.com/repos/haow1990/spark/issues{/number}","pulls_url":"https://api.github.com/repos/haow1990/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/haow1990/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/haow1990/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haow1990/spark/labels{/name}","releases_url":"https://api.github.com/repos/haow1990/spark/releases{/id}","created_at":"2015-02-04T02:56:56Z","updated_at":"2015-04-23T12:53:49Z","pushed_at":"2015-05-04T06:19:35Z","git_url":"git://github.com/haow1990/spark.git","ssh_url":"git@github.com:haow1990/spark.git","clone_url":"https://github.com/haow1990/spark.git","svn_url":"https://github.com/haow1990/spark","homepage":null,"size":92252,"stargazers_count":1,"watchers_count":1,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"witgo:lda_Gibbs","ref":"lda_Gibbs","sha":"bca468a34b25e2a4e782d02e789f360976d0e177","user":{"login":"witgo","id":302879,"avatar_url":"https://avatars.githubusercontent.com/u/302879?v=3","gravatar_id":"","url":"https://api.github.com/users/witgo","html_url":"https://github.com/witgo","followers_url":"https://api.github.com/users/witgo/followers","following_url":"https://api.github.com/users/witgo/following{/other_user}","gists_url":"https://api.github.com/users/witgo/gists{/gist_id}","starred_url":"https://api.github.com/users/witgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/witgo/subscriptions","organizations_url":"https://api.github.com/users/witgo/orgs","repos_url":"https://api.github.com/users/witgo/repos","events_url":"https://api.github.com/users/witgo/events{/privacy}","received_events_url":"https://api.github.com/users/witgo/received_events","type":"User","site_admin":false},"repo":{"id":17201985,"name":"spark","full_name":"witgo/spark","owner":{"login":"witgo","id":302879,"avatar_url":"https://avatars.githubusercontent.com/u/302879?v=3","gravatar_id":"","url":"https://api.github.com/users/witgo","html_url":"https://github.com/witgo","followers_url":"https://api.github.com/users/witgo/followers","following_url":"https://api.github.com/users/witgo/following{/other_user}","gists_url":"https://api.github.com/users/witgo/gists{/gist_id}","starred_url":"https://api.github.com/users/witgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/witgo/subscriptions","organizations_url":"https://api.github.com/users/witgo/orgs","repos_url":"https://api.github.com/users/witgo/repos","events_url":"https://api.github.com/users/witgo/events{/privacy}","received_events_url":"https://api.github.com/users/witgo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/witgo/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/witgo/spark","forks_url":"https://api.github.com/repos/witgo/spark/forks","keys_url":"https://api.github.com/repos/witgo/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/witgo/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/witgo/spark/teams","hooks_url":"https://api.github.com/repos/witgo/spark/hooks","issue_events_url":"https://api.github.com/repos/witgo/spark/issues/events{/number}","events_url":"https://api.github.com/repos/witgo/spark/events","assignees_url":"https://api.github.com/repos/witgo/spark/assignees{/user}","branches_url":"https://api.github.com/repos/witgo/spark/branches{/branch}","tags_url":"https://api.github.com/repos/witgo/spark/tags","blobs_url":"https://api.github.com/repos/witgo/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/witgo/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/witgo/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/witgo/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/witgo/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/witgo/spark/languages","stargazers_url":"https://api.github.com/repos/witgo/spark/stargazers","contributors_url":"https://api.github.com/repos/witgo/spark/contributors","subscribers_url":"https://api.github.com/repos/witgo/spark/subscribers","subscription_url":"https://api.github.com/repos/witgo/spark/subscription","commits_url":"https://api.github.com/repos/witgo/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/witgo/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/witgo/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/witgo/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/witgo/spark/contents/{+path}","compare_url":"https://api.github.com/repos/witgo/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/witgo/spark/merges","archive_url":"https://api.github.com/repos/witgo/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/witgo/spark/downloads","issues_url":"https://api.github.com/repos/witgo/spark/issues{/number}","pulls_url":"https://api.github.com/repos/witgo/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/witgo/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/witgo/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/witgo/spark/labels{/name}","releases_url":"https://api.github.com/repos/witgo/spark/releases{/id}","created_at":"2014-02-26T06:58:08Z","updated_at":"2015-04-28T06:17:20Z","pushed_at":"2015-05-04T06:25:05Z","git_url":"git://github.com/witgo/spark.git","ssh_url":"git@github.com:witgo/spark.git","clone_url":"https://github.com/witgo/spark.git","svn_url":"https://github.com/witgo/spark","homepage":null,"size":114525,"stargazers_count":5,"watchers_count":5,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/witgo/spark/pulls/1"},"html":{"href":"https://github.com/witgo/spark/pull/1"},"issue":{"href":"https://api.github.com/repos/witgo/spark/issues/1"},"comments":{"href":"https://api.github.com/repos/witgo/spark/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/witgo/spark/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/witgo/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/witgo/spark/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/witgo/spark/statuses/e7bce416f16d878694fd8338a865971dcbab4d72"}}}}