{"action":"created","issue":{"url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/16","repository_url":"https://api.github.com/repos/tzvetkoff/hashids.c","labels_url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/16/comments","events_url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/16/events","html_url":"https://github.com/tzvetkoff/hashids.c/pull/16","id":179014835,"number":16,"title":"hashids_estimate_encoded_size() performance improvements","user":{"login":"thedrow","id":48936,"avatar_url":"https://avatars.githubusercontent.com/u/48936?v=3","gravatar_id":"","url":"https://api.github.com/users/thedrow","html_url":"https://github.com/thedrow","followers_url":"https://api.github.com/users/thedrow/followers","following_url":"https://api.github.com/users/thedrow/following{/other_user}","gists_url":"https://api.github.com/users/thedrow/gists{/gist_id}","starred_url":"https://api.github.com/users/thedrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thedrow/subscriptions","organizations_url":"https://api.github.com/users/thedrow/orgs","repos_url":"https://api.github.com/users/thedrow/repos","events_url":"https://api.github.com/users/thedrow/events{/privacy}","received_events_url":"https://api.github.com/users/thedrow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-09-24T06:33:55Z","updated_at":"2016-10-08T01:58:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tzvetkoff/hashids.c/pulls/16","html_url":"https://github.com/tzvetkoff/hashids.c/pull/16","diff_url":"https://github.com/tzvetkoff/hashids.c/pull/16.diff","patch_url":"https://github.com/tzvetkoff/hashids.c/pull/16.patch"},"body":"I got rid of the conversion of `numbers[i]` and `hashids->alphabet_length` to doubles and the conversion of the result from a float to an unsigned long long integer using two tricks I found on stackoverflow:\r\n\r\n- [Fast computing of log2 for 64-bit integers](http://stackoverflow.com/questions/11376288/fast-computing-of-log2-for-64-bit-integers#answer-11398748)\r\n- [Fast ceiling of an integer division in C / C++](http://stackoverflow.com/questions/2745074/fast-ceiling-of-an-integer-division-in-c-c#answer-14878734)\r\n\r\nIt should be faster than the equivalent floating point arithmetic. \r\nI also added a test that verifies that `hashids_estimate_encoded_size()` returns at least the expected hash length."},"comment":{"url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/comments/252395605","html_url":"https://github.com/tzvetkoff/hashids.c/pull/16#issuecomment-252395605","issue_url":"https://api.github.com/repos/tzvetkoff/hashids.c/issues/16","id":252395605,"user":{"login":"tzvetkoff","id":710719,"avatar_url":"https://avatars.githubusercontent.com/u/710719?v=3","gravatar_id":"","url":"https://api.github.com/users/tzvetkoff","html_url":"https://github.com/tzvetkoff","followers_url":"https://api.github.com/users/tzvetkoff/followers","following_url":"https://api.github.com/users/tzvetkoff/following{/other_user}","gists_url":"https://api.github.com/users/tzvetkoff/gists{/gist_id}","starred_url":"https://api.github.com/users/tzvetkoff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tzvetkoff/subscriptions","organizations_url":"https://api.github.com/users/tzvetkoff/orgs","repos_url":"https://api.github.com/users/tzvetkoff/repos","events_url":"https://api.github.com/users/tzvetkoff/events{/privacy}","received_events_url":"https://api.github.com/users/tzvetkoff/received_events","type":"User","site_admin":false},"created_at":"2016-10-08T01:58:23Z","updated_at":"2016-10-08T01:58:23Z","body":"Well, at least on my Sierra, at `-O3`, I don't see any performance improvements (tested both CLang and GCC-6)\r\n"}}
{"actor":{"display_login":"tzvetkoff"}}