{"action":"closed","number":105,"pull_request":{"url":"https://api.github.com/repos/npgall/cqengine/pulls/105","id":94381184,"html_url":"https://github.com/npgall/cqengine/pull/105","diff_url":"https://github.com/npgall/cqengine/pull/105.diff","patch_url":"https://github.com/npgall/cqengine/pull/105.patch","issue_url":"https://api.github.com/repos/npgall/cqengine/issues/105","number":105,"state":"closed","locked":false,"title":"UniqueIndex query performance improvement","user":{"login":"uujava","id":5691016,"avatar_url":"https://avatars.githubusercontent.com/u/5691016?v=3","gravatar_id":"","url":"https://api.github.com/users/uujava","html_url":"https://github.com/uujava","followers_url":"https://api.github.com/users/uujava/followers","following_url":"https://api.github.com/users/uujava/following{/other_user}","gists_url":"https://api.github.com/users/uujava/gists{/gist_id}","starred_url":"https://api.github.com/users/uujava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uujava/subscriptions","organizations_url":"https://api.github.com/users/uujava/orgs","repos_url":"https://api.github.com/users/uujava/repos","events_url":"https://api.github.com/users/uujava/events{/privacy}","received_events_url":"https://api.github.com/users/uujava/received_events","type":"User","site_admin":false},"body":"I've been comparing cqengine indexed collection with UniqueIndex vs java HashMap. Got following results with cqengine build from the master branch.\r\n\r\n Benchmark | isRandom |  Mode | Cnt | Score | Units\r\n --------- | --------- | ---- | --- | ----- | -----\r\nQueryTest.queryHash | true | thrpt | 2 | 1901168.875 | ops/s\r\nQueryTest.queryHash | false | thrpt | 2 | 2105789.060 | ops/s\r\nQueryTest.uniqueQuery | true | thrpt | 2 | 624565.412 | ops/s\r\nQueryTest.uniqueQuery | false | thrpt | 2 | 696505.702 | ops/s\r\n\r\nHere I see cqengine is 3 TIMES slower, while having quite the same hashmap in the UinqueIndex. \r\nAfter analyzing the bottleneck I got the patch with performance pretty close to what I'd expect to have with cqengine and UniqueIndex:\r\n\r\n Benchmark | isRandom |  Mode | Cnt | Score | Units\r\n --------- | --------- | ---- | --- | ----- | -----\r\nQueryTest.queryHash | true | thrpt | 2 | 1956465.422 | ops/s\r\nQueryTest.queryHash | false | thrpt | 2 | 2108939.911 | ops/s\r\nQueryTest.uniqueQuery | true | thrpt | 2 | 1850139.358 | ops/s\r\nQueryTest.uniqueQuery | false | thrpt | 2 | 1854801.132 | ops/s\r\n\r\nAll cqengine build tests run smooth so I do not expect to broke anything. \r\nPlease review and include to the cqengine streamline if possible.\r\n\r\nI've been using JMH harness and test project is [here](https://github.com/uujava/cqengine-query-jmh).\r\nI was running two tests from this [perf.query.QueryTest](https://github.com/uujava/cqengine-query-jmh/blob/master/src/main/java/ru/programpark/tests/perf/query/QueryTest.java) like below: \r\n```\r\njava -jar target\\benchmarks.jar query.QueryTest.uniqueQuery -jvmArgs \"-Xmx1300m -Xms1300m -XX:+UseG1GC\" -r 10\r\njava -jar target\\benchmarks.jar query.QueryTest.hashQuery -jvmArgs \"-Xmx1300m -Xms1300m -XX:+UseG1GC\" -r 10\r\n```\r\nMy environment: Maven 3.3.9, Java8 b102 64bit, Win7 64bit\r\nHardware: Intel Core2 Quad Q9000 CPU 2Ghz, 8Gb\r\n\r\n","created_at":"2016-11-18T15:26:21Z","updated_at":"2016-11-18T21:22:05Z","closed_at":"2016-11-18T21:22:05Z","merged_at":"2016-11-18T21:22:05Z","merge_commit_sha":"6682b0c104b9acea16fef2199ce3f66ff9b58cb8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/npgall/cqengine/pulls/105/commits","review_comments_url":"https://api.github.com/repos/npgall/cqengine/pulls/105/comments","review_comment_url":"https://api.github.com/repos/npgall/cqengine/pulls/comments{/number}","comments_url":"https://api.github.com/repos/npgall/cqengine/issues/105/comments","statuses_url":"https://api.github.com/repos/npgall/cqengine/statuses/fac5e0e7fe2b537b747bcc544e8da8a1d38a81b8","head":{"label":"uujava:feature_unique_and_equals_performance","ref":"feature_unique_and_equals_performance","sha":"fac5e0e7fe2b537b747bcc544e8da8a1d38a81b8","user":{"login":"uujava","id":5691016,"avatar_url":"https://avatars.githubusercontent.com/u/5691016?v=3","gravatar_id":"","url":"https://api.github.com/users/uujava","html_url":"https://github.com/uujava","followers_url":"https://api.github.com/users/uujava/followers","following_url":"https://api.github.com/users/uujava/following{/other_user}","gists_url":"https://api.github.com/users/uujava/gists{/gist_id}","starred_url":"https://api.github.com/users/uujava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uujava/subscriptions","organizations_url":"https://api.github.com/users/uujava/orgs","repos_url":"https://api.github.com/users/uujava/repos","events_url":"https://api.github.com/users/uujava/events{/privacy}","received_events_url":"https://api.github.com/users/uujava/received_events","type":"User","site_admin":false},"repo":{"id":73933097,"name":"cqengine","full_name":"uujava/cqengine","owner":{"login":"uujava","id":5691016,"avatar_url":"https://avatars.githubusercontent.com/u/5691016?v=3","gravatar_id":"","url":"https://api.github.com/users/uujava","html_url":"https://github.com/uujava","followers_url":"https://api.github.com/users/uujava/followers","following_url":"https://api.github.com/users/uujava/following{/other_user}","gists_url":"https://api.github.com/users/uujava/gists{/gist_id}","starred_url":"https://api.github.com/users/uujava/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uujava/subscriptions","organizations_url":"https://api.github.com/users/uujava/orgs","repos_url":"https://api.github.com/users/uujava/repos","events_url":"https://api.github.com/users/uujava/events{/privacy}","received_events_url":"https://api.github.com/users/uujava/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/uujava/cqengine","description":"Ultra-fast SQL-like queries on Java collections","fork":true,"url":"https://api.github.com/repos/uujava/cqengine","forks_url":"https://api.github.com/repos/uujava/cqengine/forks","keys_url":"https://api.github.com/repos/uujava/cqengine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/uujava/cqengine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/uujava/cqengine/teams","hooks_url":"https://api.github.com/repos/uujava/cqengine/hooks","issue_events_url":"https://api.github.com/repos/uujava/cqengine/issues/events{/number}","events_url":"https://api.github.com/repos/uujava/cqengine/events","assignees_url":"https://api.github.com/repos/uujava/cqengine/assignees{/user}","branches_url":"https://api.github.com/repos/uujava/cqengine/branches{/branch}","tags_url":"https://api.github.com/repos/uujava/cqengine/tags","blobs_url":"https://api.github.com/repos/uujava/cqengine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/uujava/cqengine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/uujava/cqengine/git/refs{/sha}","trees_url":"https://api.github.com/repos/uujava/cqengine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/uujava/cqengine/statuses/{sha}","languages_url":"https://api.github.com/repos/uujava/cqengine/languages","stargazers_url":"https://api.github.com/repos/uujava/cqengine/stargazers","contributors_url":"https://api.github.com/repos/uujava/cqengine/contributors","subscribers_url":"https://api.github.com/repos/uujava/cqengine/subscribers","subscription_url":"https://api.github.com/repos/uujava/cqengine/subscription","commits_url":"https://api.github.com/repos/uujava/cqengine/commits{/sha}","git_commits_url":"https://api.github.com/repos/uujava/cqengine/git/commits{/sha}","comments_url":"https://api.github.com/repos/uujava/cqengine/comments{/number}","issue_comment_url":"https://api.github.com/repos/uujava/cqengine/issues/comments{/number}","contents_url":"https://api.github.com/repos/uujava/cqengine/contents/{+path}","compare_url":"https://api.github.com/repos/uujava/cqengine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/uujava/cqengine/merges","archive_url":"https://api.github.com/repos/uujava/cqengine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/uujava/cqengine/downloads","issues_url":"https://api.github.com/repos/uujava/cqengine/issues{/number}","pulls_url":"https://api.github.com/repos/uujava/cqengine/pulls{/number}","milestones_url":"https://api.github.com/repos/uujava/cqengine/milestones{/number}","notifications_url":"https://api.github.com/repos/uujava/cqengine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/uujava/cqengine/labels{/name}","releases_url":"https://api.github.com/repos/uujava/cqengine/releases{/id}","deployments_url":"https://api.github.com/repos/uujava/cqengine/deployments","created_at":"2016-11-16T15:28:36Z","updated_at":"2016-11-16T15:28:39Z","pushed_at":"2016-11-18T20:32:27Z","git_url":"git://github.com/uujava/cqengine.git","ssh_url":"git@github.com:uujava/cqengine.git","clone_url":"https://github.com/uujava/cqengine.git","svn_url":"https://github.com/uujava/cqengine","homepage":"","size":8217,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"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":"npgall:master","ref":"master","sha":"b05e384da878ef311ead95e139056b59380802f7","user":{"login":"npgall","id":2853258,"avatar_url":"https://avatars.githubusercontent.com/u/2853258?v=3","gravatar_id":"","url":"https://api.github.com/users/npgall","html_url":"https://github.com/npgall","followers_url":"https://api.github.com/users/npgall/followers","following_url":"https://api.github.com/users/npgall/following{/other_user}","gists_url":"https://api.github.com/users/npgall/gists{/gist_id}","starred_url":"https://api.github.com/users/npgall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npgall/subscriptions","organizations_url":"https://api.github.com/users/npgall/orgs","repos_url":"https://api.github.com/users/npgall/repos","events_url":"https://api.github.com/users/npgall/events{/privacy}","received_events_url":"https://api.github.com/users/npgall/received_events","type":"User","site_admin":false},"repo":{"id":41263775,"name":"cqengine","full_name":"npgall/cqengine","owner":{"login":"npgall","id":2853258,"avatar_url":"https://avatars.githubusercontent.com/u/2853258?v=3","gravatar_id":"","url":"https://api.github.com/users/npgall","html_url":"https://github.com/npgall","followers_url":"https://api.github.com/users/npgall/followers","following_url":"https://api.github.com/users/npgall/following{/other_user}","gists_url":"https://api.github.com/users/npgall/gists{/gist_id}","starred_url":"https://api.github.com/users/npgall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npgall/subscriptions","organizations_url":"https://api.github.com/users/npgall/orgs","repos_url":"https://api.github.com/users/npgall/repos","events_url":"https://api.github.com/users/npgall/events{/privacy}","received_events_url":"https://api.github.com/users/npgall/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/npgall/cqengine","description":"Ultra-fast SQL-like queries on Java collections","fork":false,"url":"https://api.github.com/repos/npgall/cqengine","forks_url":"https://api.github.com/repos/npgall/cqengine/forks","keys_url":"https://api.github.com/repos/npgall/cqengine/keys{/key_id}","collaborators_url":"https://api.github.com/repos/npgall/cqengine/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/npgall/cqengine/teams","hooks_url":"https://api.github.com/repos/npgall/cqengine/hooks","issue_events_url":"https://api.github.com/repos/npgall/cqengine/issues/events{/number}","events_url":"https://api.github.com/repos/npgall/cqengine/events","assignees_url":"https://api.github.com/repos/npgall/cqengine/assignees{/user}","branches_url":"https://api.github.com/repos/npgall/cqengine/branches{/branch}","tags_url":"https://api.github.com/repos/npgall/cqengine/tags","blobs_url":"https://api.github.com/repos/npgall/cqengine/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/npgall/cqengine/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/npgall/cqengine/git/refs{/sha}","trees_url":"https://api.github.com/repos/npgall/cqengine/git/trees{/sha}","statuses_url":"https://api.github.com/repos/npgall/cqengine/statuses/{sha}","languages_url":"https://api.github.com/repos/npgall/cqengine/languages","stargazers_url":"https://api.github.com/repos/npgall/cqengine/stargazers","contributors_url":"https://api.github.com/repos/npgall/cqengine/contributors","subscribers_url":"https://api.github.com/repos/npgall/cqengine/subscribers","subscription_url":"https://api.github.com/repos/npgall/cqengine/subscription","commits_url":"https://api.github.com/repos/npgall/cqengine/commits{/sha}","git_commits_url":"https://api.github.com/repos/npgall/cqengine/git/commits{/sha}","comments_url":"https://api.github.com/repos/npgall/cqengine/comments{/number}","issue_comment_url":"https://api.github.com/repos/npgall/cqengine/issues/comments{/number}","contents_url":"https://api.github.com/repos/npgall/cqengine/contents/{+path}","compare_url":"https://api.github.com/repos/npgall/cqengine/compare/{base}...{head}","merges_url":"https://api.github.com/repos/npgall/cqengine/merges","archive_url":"https://api.github.com/repos/npgall/cqengine/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/npgall/cqengine/downloads","issues_url":"https://api.github.com/repos/npgall/cqengine/issues{/number}","pulls_url":"https://api.github.com/repos/npgall/cqengine/pulls{/number}","milestones_url":"https://api.github.com/repos/npgall/cqengine/milestones{/number}","notifications_url":"https://api.github.com/repos/npgall/cqengine/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/npgall/cqengine/labels{/name}","releases_url":"https://api.github.com/repos/npgall/cqengine/releases{/id}","deployments_url":"https://api.github.com/repos/npgall/cqengine/deployments","created_at":"2015-08-23T19:27:00Z","updated_at":"2016-11-17T21:32:11Z","pushed_at":"2016-11-18T21:22:05Z","git_url":"git://github.com/npgall/cqengine.git","ssh_url":"git@github.com:npgall/cqengine.git","clone_url":"https://github.com/npgall/cqengine.git","svn_url":"https://github.com/npgall/cqengine","homepage":"","size":8727,"stargazers_count":330,"watchers_count":330,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":59,"mirror_url":null,"open_issues_count":11,"forks":59,"open_issues":11,"watchers":330,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/npgall/cqengine/pulls/105"},"html":{"href":"https://github.com/npgall/cqengine/pull/105"},"issue":{"href":"https://api.github.com/repos/npgall/cqengine/issues/105"},"comments":{"href":"https://api.github.com/repos/npgall/cqengine/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/npgall/cqengine/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/npgall/cqengine/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/npgall/cqengine/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/npgall/cqengine/statuses/fac5e0e7fe2b537b747bcc544e8da8a1d38a81b8"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"npgall","id":2853258,"avatar_url":"https://avatars.githubusercontent.com/u/2853258?v=3","gravatar_id":"","url":"https://api.github.com/users/npgall","html_url":"https://github.com/npgall","followers_url":"https://api.github.com/users/npgall/followers","following_url":"https://api.github.com/users/npgall/following{/other_user}","gists_url":"https://api.github.com/users/npgall/gists{/gist_id}","starred_url":"https://api.github.com/users/npgall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npgall/subscriptions","organizations_url":"https://api.github.com/users/npgall/orgs","repos_url":"https://api.github.com/users/npgall/repos","events_url":"https://api.github.com/users/npgall/events{/privacy}","received_events_url":"https://api.github.com/users/npgall/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":2,"additions":19,"deletions":0,"changed_files":1}}
{"actor":{"display_login":"npgall"}}