{"action":"opened","number":34,"pull_request":{"url":"https://api.github.com/repos/zero-db/zerodb/pulls/34","id":61512695,"html_url":"https://github.com/zero-db/zerodb/pull/34","diff_url":"https://github.com/zero-db/zerodb/pull/34.diff","patch_url":"https://github.com/zero-db/zerodb/pull/34.patch","issue_url":"https://api.github.com/repos/zero-db/zerodb/issues/34","number":34,"state":"open","locked":false,"title":"Optimize btree_state_search","user":{"login":"micxjo","id":16166954,"avatar_url":"https://avatars.githubusercontent.com/u/16166954?v=3","gravatar_id":"","url":"https://api.github.com/users/micxjo","html_url":"https://github.com/micxjo","followers_url":"https://api.github.com/users/micxjo/followers","following_url":"https://api.github.com/users/micxjo/following{/other_user}","gists_url":"https://api.github.com/users/micxjo/gists{/gist_id}","starred_url":"https://api.github.com/users/micxjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micxjo/subscriptions","organizations_url":"https://api.github.com/users/micxjo/orgs","repos_url":"https://api.github.com/users/micxjo/repos","events_url":"https://api.github.com/users/micxjo/events{/privacy}","received_events_url":"https://api.github.com/users/micxjo/received_events","type":"User","site_admin":false},"body":"Based on playing around w/ https://github.com/zero-db/zerodb-benchmarks I saw that btree_state_search was a good candidate for a little micro-optimization. The change below decreases the default benchmark runtime by a little more than 10% for me (CPython2.7). Plus, it's python3 compatible (no cmp()).\r\n\r\nNote that the `if i > 0` check in `get_key` is unnecessary because we know that `i > lo and lo >= 0`. ","created_at":"2016-03-03T05:32:11Z","updated_at":"2016-03-03T05:32:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"12876e51b6ec213f616b356a63f4ec26a4c3b445","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/zero-db/zerodb/pulls/34/commits","review_comments_url":"https://api.github.com/repos/zero-db/zerodb/pulls/34/comments","review_comment_url":"https://api.github.com/repos/zero-db/zerodb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zero-db/zerodb/issues/34/comments","statuses_url":"https://api.github.com/repos/zero-db/zerodb/statuses/87359dc84cc0673c25e4d9d10e0a45eda24ee90e","head":{"label":"micxjo:optimize","ref":"optimize","sha":"87359dc84cc0673c25e4d9d10e0a45eda24ee90e","user":{"login":"micxjo","id":16166954,"avatar_url":"https://avatars.githubusercontent.com/u/16166954?v=3","gravatar_id":"","url":"https://api.github.com/users/micxjo","html_url":"https://github.com/micxjo","followers_url":"https://api.github.com/users/micxjo/followers","following_url":"https://api.github.com/users/micxjo/following{/other_user}","gists_url":"https://api.github.com/users/micxjo/gists{/gist_id}","starred_url":"https://api.github.com/users/micxjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micxjo/subscriptions","organizations_url":"https://api.github.com/users/micxjo/orgs","repos_url":"https://api.github.com/users/micxjo/repos","events_url":"https://api.github.com/users/micxjo/events{/privacy}","received_events_url":"https://api.github.com/users/micxjo/received_events","type":"User","site_admin":false},"repo":{"id":52961486,"name":"zerodb","full_name":"micxjo/zerodb","owner":{"login":"micxjo","id":16166954,"avatar_url":"https://avatars.githubusercontent.com/u/16166954?v=3","gravatar_id":"","url":"https://api.github.com/users/micxjo","html_url":"https://github.com/micxjo","followers_url":"https://api.github.com/users/micxjo/followers","following_url":"https://api.github.com/users/micxjo/following{/other_user}","gists_url":"https://api.github.com/users/micxjo/gists{/gist_id}","starred_url":"https://api.github.com/users/micxjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micxjo/subscriptions","organizations_url":"https://api.github.com/users/micxjo/orgs","repos_url":"https://api.github.com/users/micxjo/repos","events_url":"https://api.github.com/users/micxjo/events{/privacy}","received_events_url":"https://api.github.com/users/micxjo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/micxjo/zerodb","description":"ZeroDB is an end-to-end encrypted database. Data can be stored and queried on untrusted database servers without ever exposing the encryption key. Clients can execute remote queries against the encrypted data without downloading all of it or suffering an excessive performance hit.","fork":true,"url":"https://api.github.com/repos/micxjo/zerodb","forks_url":"https://api.github.com/repos/micxjo/zerodb/forks","keys_url":"https://api.github.com/repos/micxjo/zerodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/micxjo/zerodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/micxjo/zerodb/teams","hooks_url":"https://api.github.com/repos/micxjo/zerodb/hooks","issue_events_url":"https://api.github.com/repos/micxjo/zerodb/issues/events{/number}","events_url":"https://api.github.com/repos/micxjo/zerodb/events","assignees_url":"https://api.github.com/repos/micxjo/zerodb/assignees{/user}","branches_url":"https://api.github.com/repos/micxjo/zerodb/branches{/branch}","tags_url":"https://api.github.com/repos/micxjo/zerodb/tags","blobs_url":"https://api.github.com/repos/micxjo/zerodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/micxjo/zerodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/micxjo/zerodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/micxjo/zerodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/micxjo/zerodb/statuses/{sha}","languages_url":"https://api.github.com/repos/micxjo/zerodb/languages","stargazers_url":"https://api.github.com/repos/micxjo/zerodb/stargazers","contributors_url":"https://api.github.com/repos/micxjo/zerodb/contributors","subscribers_url":"https://api.github.com/repos/micxjo/zerodb/subscribers","subscription_url":"https://api.github.com/repos/micxjo/zerodb/subscription","commits_url":"https://api.github.com/repos/micxjo/zerodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/micxjo/zerodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/micxjo/zerodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/micxjo/zerodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/micxjo/zerodb/contents/{+path}","compare_url":"https://api.github.com/repos/micxjo/zerodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/micxjo/zerodb/merges","archive_url":"https://api.github.com/repos/micxjo/zerodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/micxjo/zerodb/downloads","issues_url":"https://api.github.com/repos/micxjo/zerodb/issues{/number}","pulls_url":"https://api.github.com/repos/micxjo/zerodb/pulls{/number}","milestones_url":"https://api.github.com/repos/micxjo/zerodb/milestones{/number}","notifications_url":"https://api.github.com/repos/micxjo/zerodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/micxjo/zerodb/labels{/name}","releases_url":"https://api.github.com/repos/micxjo/zerodb/releases{/id}","deployments_url":"https://api.github.com/repos/micxjo/zerodb/deployments","created_at":"2016-03-02T12:36:04Z","updated_at":"2016-03-02T12:36:05Z","pushed_at":"2016-03-03T05:20:17Z","git_url":"git://github.com/micxjo/zerodb.git","ssh_url":"git@github.com:micxjo/zerodb.git","clone_url":"https://github.com/micxjo/zerodb.git","svn_url":"https://github.com/micxjo/zerodb","homepage":"http://www.zerodb.io/","size":3348,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"zero-db:master","ref":"master","sha":"bcb5b1458fa321556b3194f9579b50007ddb5712","user":{"login":"zero-db","id":12001432,"avatar_url":"https://avatars.githubusercontent.com/u/12001432?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-db","html_url":"https://github.com/zero-db","followers_url":"https://api.github.com/users/zero-db/followers","following_url":"https://api.github.com/users/zero-db/following{/other_user}","gists_url":"https://api.github.com/users/zero-db/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-db/subscriptions","organizations_url":"https://api.github.com/users/zero-db/orgs","repos_url":"https://api.github.com/users/zero-db/repos","events_url":"https://api.github.com/users/zero-db/events{/privacy}","received_events_url":"https://api.github.com/users/zero-db/received_events","type":"Organization","site_admin":false},"repo":{"id":47479424,"name":"zerodb","full_name":"zero-db/zerodb","owner":{"login":"zero-db","id":12001432,"avatar_url":"https://avatars.githubusercontent.com/u/12001432?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-db","html_url":"https://github.com/zero-db","followers_url":"https://api.github.com/users/zero-db/followers","following_url":"https://api.github.com/users/zero-db/following{/other_user}","gists_url":"https://api.github.com/users/zero-db/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-db/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-db/subscriptions","organizations_url":"https://api.github.com/users/zero-db/orgs","repos_url":"https://api.github.com/users/zero-db/repos","events_url":"https://api.github.com/users/zero-db/events{/privacy}","received_events_url":"https://api.github.com/users/zero-db/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zero-db/zerodb","description":"ZeroDB is an end-to-end encrypted database. Data can be stored and queried on untrusted database servers without ever exposing the encryption key. Clients can execute remote queries against the encrypted data without downloading all of it or suffering an excessive performance hit.","fork":false,"url":"https://api.github.com/repos/zero-db/zerodb","forks_url":"https://api.github.com/repos/zero-db/zerodb/forks","keys_url":"https://api.github.com/repos/zero-db/zerodb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zero-db/zerodb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zero-db/zerodb/teams","hooks_url":"https://api.github.com/repos/zero-db/zerodb/hooks","issue_events_url":"https://api.github.com/repos/zero-db/zerodb/issues/events{/number}","events_url":"https://api.github.com/repos/zero-db/zerodb/events","assignees_url":"https://api.github.com/repos/zero-db/zerodb/assignees{/user}","branches_url":"https://api.github.com/repos/zero-db/zerodb/branches{/branch}","tags_url":"https://api.github.com/repos/zero-db/zerodb/tags","blobs_url":"https://api.github.com/repos/zero-db/zerodb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zero-db/zerodb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zero-db/zerodb/git/refs{/sha}","trees_url":"https://api.github.com/repos/zero-db/zerodb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zero-db/zerodb/statuses/{sha}","languages_url":"https://api.github.com/repos/zero-db/zerodb/languages","stargazers_url":"https://api.github.com/repos/zero-db/zerodb/stargazers","contributors_url":"https://api.github.com/repos/zero-db/zerodb/contributors","subscribers_url":"https://api.github.com/repos/zero-db/zerodb/subscribers","subscription_url":"https://api.github.com/repos/zero-db/zerodb/subscription","commits_url":"https://api.github.com/repos/zero-db/zerodb/commits{/sha}","git_commits_url":"https://api.github.com/repos/zero-db/zerodb/git/commits{/sha}","comments_url":"https://api.github.com/repos/zero-db/zerodb/comments{/number}","issue_comment_url":"https://api.github.com/repos/zero-db/zerodb/issues/comments{/number}","contents_url":"https://api.github.com/repos/zero-db/zerodb/contents/{+path}","compare_url":"https://api.github.com/repos/zero-db/zerodb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zero-db/zerodb/merges","archive_url":"https://api.github.com/repos/zero-db/zerodb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zero-db/zerodb/downloads","issues_url":"https://api.github.com/repos/zero-db/zerodb/issues{/number}","pulls_url":"https://api.github.com/repos/zero-db/zerodb/pulls{/number}","milestones_url":"https://api.github.com/repos/zero-db/zerodb/milestones{/number}","notifications_url":"https://api.github.com/repos/zero-db/zerodb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zero-db/zerodb/labels{/name}","releases_url":"https://api.github.com/repos/zero-db/zerodb/releases{/id}","deployments_url":"https://api.github.com/repos/zero-db/zerodb/deployments","created_at":"2015-12-06T01:29:13Z","updated_at":"2016-03-02T21:12:18Z","pushed_at":"2016-03-03T05:32:11Z","git_url":"git://github.com/zero-db/zerodb.git","ssh_url":"git@github.com:zero-db/zerodb.git","clone_url":"https://github.com/zero-db/zerodb.git","svn_url":"https://github.com/zero-db/zerodb","homepage":"http://www.zerodb.io/","size":3340,"stargazers_count":1377,"watchers_count":1377,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":16,"forks":74,"open_issues":16,"watchers":1377,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zero-db/zerodb/pulls/34"},"html":{"href":"https://github.com/zero-db/zerodb/pull/34"},"issue":{"href":"https://api.github.com/repos/zero-db/zerodb/issues/34"},"comments":{"href":"https://api.github.com/repos/zero-db/zerodb/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/zero-db/zerodb/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/zero-db/zerodb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zero-db/zerodb/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/zero-db/zerodb/statuses/87359dc84cc0673c25e4d9d10e0a45eda24ee90e"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":7,"deletions":9,"changed_files":1}}