{"action":"created","comment":{"url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/comments/32685247","id":32685247,"diff_hunk":"@@ -56,10 +58,19 @@ public Searcher forSearch() {\n \n \t/** @return Serializable thrift representation */\n \tpublic Word2VecModelThrift toThrift() {\n+\t\tdouble[] vectorsArray;\n+\t\ttry {\n+\t\t\tvectorsArray = vectors.array();\n+\t\t} catch (UnsupportedOperationException e) {\n+\t\t\tvectorsArray = new double[vectors.limit()];","path":"src/main/java/com/medallia/word2vec/Word2VecModel.java","position":41,"original_position":41,"commit_id":"e7e6efd3b6435adf85aa8c8914906dda83cf6719","original_commit_id":"e7e6efd3b6435adf85aa8c8914906dda83cf6719","user":{"login":"wko27","id":1747455,"avatar_url":"https://avatars.githubusercontent.com/u/1747455?v=3","gravatar_id":"","url":"https://api.github.com/users/wko27","html_url":"https://github.com/wko27","followers_url":"https://api.github.com/users/wko27/followers","following_url":"https://api.github.com/users/wko27/following{/other_user}","gists_url":"https://api.github.com/users/wko27/gists{/gist_id}","starred_url":"https://api.github.com/users/wko27/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wko27/subscriptions","organizations_url":"https://api.github.com/users/wko27/orgs","repos_url":"https://api.github.com/users/wko27/repos","events_url":"https://api.github.com/users/wko27/events{/privacy}","received_events_url":"https://api.github.com/users/wko27/received_events","type":"User","site_admin":false},"body":"Let's check via vectors.hasArray instead of using exception handling?","created_at":"2015-06-17T23:07:24Z","updated_at":"2015-06-17T23:07:24Z","html_url":"https://github.com/medallia/Word2VecJava/pull/22#discussion_r32685247","pull_request_url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/comments/32685247"},"html":{"href":"https://github.com/medallia/Word2VecJava/pull/22#discussion_r32685247"},"pull_request":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22","id":37423105,"html_url":"https://github.com/medallia/Word2VecJava/pull/22","diff_url":"https://github.com/medallia/Word2VecJava/pull/22.diff","patch_url":"https://github.com/medallia/Word2VecJava/pull/22.patch","issue_url":"https://api.github.com/repos/medallia/Word2VecJava/issues/22","number":22,"state":"open","locked":false,"title":"Stores vectors in off-heap buffers","user":{"login":"dirkgr","id":920638,"avatar_url":"https://avatars.githubusercontent.com/u/920638?v=3","gravatar_id":"","url":"https://api.github.com/users/dirkgr","html_url":"https://github.com/dirkgr","followers_url":"https://api.github.com/users/dirkgr/followers","following_url":"https://api.github.com/users/dirkgr/following{/other_user}","gists_url":"https://api.github.com/users/dirkgr/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkgr/subscriptions","organizations_url":"https://api.github.com/users/dirkgr/orgs","repos_url":"https://api.github.com/users/dirkgr/repos","events_url":"https://api.github.com/users/dirkgr/events{/privacy}","received_events_url":"https://api.github.com/users/dirkgr/received_events","type":"User","site_admin":false},"body":"This is a different approach to #19. Instead of storing the vectors in arrays of `double`, it stores them in instances of `DoubleBuffer`, which are backed by off-heap byte buffers. That means they don't contribute to the heap size at all, and the OS can swap them out if there is no memory available.\r\n\r\nIt solves the immediate problem of loading and normalizing a model that fits in memory only once, with not a lot of extra complexity or performance hit.","created_at":"2015-06-11T02:09:21Z","updated_at":"2015-06-17T23:07:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d766bbee4e7731cae5d19a676b9cfc83a8a8d8fa","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22/commits","review_comments_url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22/comments","review_comment_url":"https://api.github.com/repos/medallia/Word2VecJava/pulls/comments{/number}","comments_url":"https://api.github.com/repos/medallia/Word2VecJava/issues/22/comments","statuses_url":"https://api.github.com/repos/medallia/Word2VecJava/statuses/e7e6efd3b6435adf85aa8c8914906dda83cf6719","head":{"label":"dirkgr:StoreModelsOnlyOnce2","ref":"StoreModelsOnlyOnce2","sha":"e7e6efd3b6435adf85aa8c8914906dda83cf6719","user":{"login":"dirkgr","id":920638,"avatar_url":"https://avatars.githubusercontent.com/u/920638?v=3","gravatar_id":"","url":"https://api.github.com/users/dirkgr","html_url":"https://github.com/dirkgr","followers_url":"https://api.github.com/users/dirkgr/followers","following_url":"https://api.github.com/users/dirkgr/following{/other_user}","gists_url":"https://api.github.com/users/dirkgr/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkgr/subscriptions","organizations_url":"https://api.github.com/users/dirkgr/orgs","repos_url":"https://api.github.com/users/dirkgr/repos","events_url":"https://api.github.com/users/dirkgr/events{/privacy}","received_events_url":"https://api.github.com/users/dirkgr/received_events","type":"User","site_admin":false},"repo":{"id":35248233,"name":"Word2VecJava","full_name":"dirkgr/Word2VecJava","owner":{"login":"dirkgr","id":920638,"avatar_url":"https://avatars.githubusercontent.com/u/920638?v=3","gravatar_id":"","url":"https://api.github.com/users/dirkgr","html_url":"https://github.com/dirkgr","followers_url":"https://api.github.com/users/dirkgr/followers","following_url":"https://api.github.com/users/dirkgr/following{/other_user}","gists_url":"https://api.github.com/users/dirkgr/gists{/gist_id}","starred_url":"https://api.github.com/users/dirkgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirkgr/subscriptions","organizations_url":"https://api.github.com/users/dirkgr/orgs","repos_url":"https://api.github.com/users/dirkgr/repos","events_url":"https://api.github.com/users/dirkgr/events{/privacy}","received_events_url":"https://api.github.com/users/dirkgr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dirkgr/Word2VecJava","description":"Word2Vec Java Port","fork":true,"url":"https://api.github.com/repos/dirkgr/Word2VecJava","forks_url":"https://api.github.com/repos/dirkgr/Word2VecJava/forks","keys_url":"https://api.github.com/repos/dirkgr/Word2VecJava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dirkgr/Word2VecJava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dirkgr/Word2VecJava/teams","hooks_url":"https://api.github.com/repos/dirkgr/Word2VecJava/hooks","issue_events_url":"https://api.github.com/repos/dirkgr/Word2VecJava/issues/events{/number}","events_url":"https://api.github.com/repos/dirkgr/Word2VecJava/events","assignees_url":"https://api.github.com/repos/dirkgr/Word2VecJava/assignees{/user}","branches_url":"https://api.github.com/repos/dirkgr/Word2VecJava/branches{/branch}","tags_url":"https://api.github.com/repos/dirkgr/Word2VecJava/tags","blobs_url":"https://api.github.com/repos/dirkgr/Word2VecJava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dirkgr/Word2VecJava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dirkgr/Word2VecJava/git/refs{/sha}","trees_url":"https://api.github.com/repos/dirkgr/Word2VecJava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dirkgr/Word2VecJava/statuses/{sha}","languages_url":"https://api.github.com/repos/dirkgr/Word2VecJava/languages","stargazers_url":"https://api.github.com/repos/dirkgr/Word2VecJava/stargazers","contributors_url":"https://api.github.com/repos/dirkgr/Word2VecJava/contributors","subscribers_url":"https://api.github.com/repos/dirkgr/Word2VecJava/subscribers","subscription_url":"https://api.github.com/repos/dirkgr/Word2VecJava/subscription","commits_url":"https://api.github.com/repos/dirkgr/Word2VecJava/commits{/sha}","git_commits_url":"https://api.github.com/repos/dirkgr/Word2VecJava/git/commits{/sha}","comments_url":"https://api.github.com/repos/dirkgr/Word2VecJava/comments{/number}","issue_comment_url":"https://api.github.com/repos/dirkgr/Word2VecJava/issues/comments{/number}","contents_url":"https://api.github.com/repos/dirkgr/Word2VecJava/contents/{+path}","compare_url":"https://api.github.com/repos/dirkgr/Word2VecJava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dirkgr/Word2VecJava/merges","archive_url":"https://api.github.com/repos/dirkgr/Word2VecJava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dirkgr/Word2VecJava/downloads","issues_url":"https://api.github.com/repos/dirkgr/Word2VecJava/issues{/number}","pulls_url":"https://api.github.com/repos/dirkgr/Word2VecJava/pulls{/number}","milestones_url":"https://api.github.com/repos/dirkgr/Word2VecJava/milestones{/number}","notifications_url":"https://api.github.com/repos/dirkgr/Word2VecJava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dirkgr/Word2VecJava/labels{/name}","releases_url":"https://api.github.com/repos/dirkgr/Word2VecJava/releases{/id}","created_at":"2015-05-07T23:18:17Z","updated_at":"2015-05-07T23:18:17Z","pushed_at":"2015-06-17T19:02:24Z","git_url":"git://github.com/dirkgr/Word2VecJava.git","ssh_url":"git@github.com:dirkgr/Word2VecJava.git","clone_url":"https://github.com/dirkgr/Word2VecJava.git","svn_url":"https://github.com/dirkgr/Word2VecJava","homepage":null,"size":5568,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"medallia:master","ref":"master","sha":"57bbe5c11935eda9703ea7817a1e3b6fa434cf4e","user":{"login":"medallia","id":2198222,"avatar_url":"https://avatars.githubusercontent.com/u/2198222?v=3","gravatar_id":"","url":"https://api.github.com/users/medallia","html_url":"https://github.com/medallia","followers_url":"https://api.github.com/users/medallia/followers","following_url":"https://api.github.com/users/medallia/following{/other_user}","gists_url":"https://api.github.com/users/medallia/gists{/gist_id}","starred_url":"https://api.github.com/users/medallia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medallia/subscriptions","organizations_url":"https://api.github.com/users/medallia/orgs","repos_url":"https://api.github.com/users/medallia/repos","events_url":"https://api.github.com/users/medallia/events{/privacy}","received_events_url":"https://api.github.com/users/medallia/received_events","type":"Organization","site_admin":false},"repo":{"id":30221889,"name":"Word2VecJava","full_name":"medallia/Word2VecJava","owner":{"login":"medallia","id":2198222,"avatar_url":"https://avatars.githubusercontent.com/u/2198222?v=3","gravatar_id":"","url":"https://api.github.com/users/medallia","html_url":"https://github.com/medallia","followers_url":"https://api.github.com/users/medallia/followers","following_url":"https://api.github.com/users/medallia/following{/other_user}","gists_url":"https://api.github.com/users/medallia/gists{/gist_id}","starred_url":"https://api.github.com/users/medallia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/medallia/subscriptions","organizations_url":"https://api.github.com/users/medallia/orgs","repos_url":"https://api.github.com/users/medallia/repos","events_url":"https://api.github.com/users/medallia/events{/privacy}","received_events_url":"https://api.github.com/users/medallia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/medallia/Word2VecJava","description":"Word2Vec Java Port","fork":false,"url":"https://api.github.com/repos/medallia/Word2VecJava","forks_url":"https://api.github.com/repos/medallia/Word2VecJava/forks","keys_url":"https://api.github.com/repos/medallia/Word2VecJava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/medallia/Word2VecJava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/medallia/Word2VecJava/teams","hooks_url":"https://api.github.com/repos/medallia/Word2VecJava/hooks","issue_events_url":"https://api.github.com/repos/medallia/Word2VecJava/issues/events{/number}","events_url":"https://api.github.com/repos/medallia/Word2VecJava/events","assignees_url":"https://api.github.com/repos/medallia/Word2VecJava/assignees{/user}","branches_url":"https://api.github.com/repos/medallia/Word2VecJava/branches{/branch}","tags_url":"https://api.github.com/repos/medallia/Word2VecJava/tags","blobs_url":"https://api.github.com/repos/medallia/Word2VecJava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/medallia/Word2VecJava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/medallia/Word2VecJava/git/refs{/sha}","trees_url":"https://api.github.com/repos/medallia/Word2VecJava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/medallia/Word2VecJava/statuses/{sha}","languages_url":"https://api.github.com/repos/medallia/Word2VecJava/languages","stargazers_url":"https://api.github.com/repos/medallia/Word2VecJava/stargazers","contributors_url":"https://api.github.com/repos/medallia/Word2VecJava/contributors","subscribers_url":"https://api.github.com/repos/medallia/Word2VecJava/subscribers","subscription_url":"https://api.github.com/repos/medallia/Word2VecJava/subscription","commits_url":"https://api.github.com/repos/medallia/Word2VecJava/commits{/sha}","git_commits_url":"https://api.github.com/repos/medallia/Word2VecJava/git/commits{/sha}","comments_url":"https://api.github.com/repos/medallia/Word2VecJava/comments{/number}","issue_comment_url":"https://api.github.com/repos/medallia/Word2VecJava/issues/comments{/number}","contents_url":"https://api.github.com/repos/medallia/Word2VecJava/contents/{+path}","compare_url":"https://api.github.com/repos/medallia/Word2VecJava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/medallia/Word2VecJava/merges","archive_url":"https://api.github.com/repos/medallia/Word2VecJava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/medallia/Word2VecJava/downloads","issues_url":"https://api.github.com/repos/medallia/Word2VecJava/issues{/number}","pulls_url":"https://api.github.com/repos/medallia/Word2VecJava/pulls{/number}","milestones_url":"https://api.github.com/repos/medallia/Word2VecJava/milestones{/number}","notifications_url":"https://api.github.com/repos/medallia/Word2VecJava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/medallia/Word2VecJava/labels{/name}","releases_url":"https://api.github.com/repos/medallia/Word2VecJava/releases{/id}","created_at":"2015-02-03T03:04:49Z","updated_at":"2015-06-11T02:01:03Z","pushed_at":"2015-06-11T02:09:22Z","git_url":"git://github.com/medallia/Word2VecJava.git","ssh_url":"git@github.com:medallia/Word2VecJava.git","clone_url":"https://github.com/medallia/Word2VecJava.git","svn_url":"https://github.com/medallia/Word2VecJava","homepage":null,"size":5834,"stargazers_count":31,"watchers_count":31,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":6,"forks":13,"open_issues":6,"watchers":31,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22"},"html":{"href":"https://github.com/medallia/Word2VecJava/pull/22"},"issue":{"href":"https://api.github.com/repos/medallia/Word2VecJava/issues/22"},"comments":{"href":"https://api.github.com/repos/medallia/Word2VecJava/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/medallia/Word2VecJava/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/medallia/Word2VecJava/statuses/e7e6efd3b6435adf85aa8c8914906dda83cf6719"}}}}