{"action":"created","issue":{"url":"https://api.github.com/repos/edx/opaque-keys/issues/67","repository_url":"https://api.github.com/repos/edx/opaque-keys","labels_url":"https://api.github.com/repos/edx/opaque-keys/issues/67/labels{/name}","comments_url":"https://api.github.com/repos/edx/opaque-keys/issues/67/comments","events_url":"https://api.github.com/repos/edx/opaque-keys/issues/67/events","html_url":"https://github.com/edx/opaque-keys/pull/67","id":134891559,"number":67,"title":"PERF: Optimize key hashing and equality comparison","user":{"login":"ormsbee","id":41625,"avatar_url":"https://avatars.githubusercontent.com/u/41625?v=3","gravatar_id":"","url":"https://api.github.com/users/ormsbee","html_url":"https://github.com/ormsbee","followers_url":"https://api.github.com/users/ormsbee/followers","following_url":"https://api.github.com/users/ormsbee/following{/other_user}","gists_url":"https://api.github.com/users/ormsbee/gists{/gist_id}","starred_url":"https://api.github.com/users/ormsbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ormsbee/subscriptions","organizations_url":"https://api.github.com/users/ormsbee/orgs","repos_url":"https://api.github.com/users/ormsbee/repos","events_url":"https://api.github.com/users/ormsbee/events{/privacy}","received_events_url":"https://api.github.com/users/ormsbee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-02-19T15:25:02Z","updated_at":"2016-07-15T00:43:45Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/edx/opaque-keys/pulls/67","html_url":"https://github.com/edx/opaque-keys/pull/67","diff_url":"https://github.com/edx/opaque-keys/pull/67.diff","patch_url":"https://github.com/edx/opaque-keys/pull/67.patch"},"body":"Okay folks, thank you for your patience. I think this is now in a reviewable state.\r\n\r\nLooking at the progress page of a fairly large course (~1.3K blocks) here are three things that happen over and over to OpaqueKeys \r\n\r\n1. Hashing (114K times)\r\n2. Serialization to unicode (49K times)\r\n3. Equality checks (19K times)\r\n\r\nThis PR tries to address those issues by:\r\n\r\n1. Storing the hash explicitly as an integer attribute, so we can throw it back with no work.\r\n2. Storing the serialized unicode representation (which is simple, since that's usually how it's constructed).\r\n3. Intern the OpaqueKeys.\r\n\r\nThe third one helps avoiding the extra work of hashing and serialization, but it also makes equality faster because we can short circuit them using object identity and hash value (both of which are cheap to check).\r\n\r\nMy biggest concern is the possible memory leak in the explicit cache pool. I use a `WeakValueDictionary`, but I don't know as that's enough. On the bright side, I think we create far fewer OpaqueKeys during a given request now...\r\n\r\n@nedbat, @nasthagiri, @doctoryes, @cpennington: May I get a review from two of you folks?"},"comment":{"url":"https://api.github.com/repos/edx/opaque-keys/issues/comments/232832000","html_url":"https://github.com/edx/opaque-keys/pull/67#issuecomment-232832000","issue_url":"https://api.github.com/repos/edx/opaque-keys/issues/67","id":232832000,"user":{"login":"ormsbee","id":41625,"avatar_url":"https://avatars.githubusercontent.com/u/41625?v=3","gravatar_id":"","url":"https://api.github.com/users/ormsbee","html_url":"https://github.com/ormsbee","followers_url":"https://api.github.com/users/ormsbee/followers","following_url":"https://api.github.com/users/ormsbee/following{/other_user}","gists_url":"https://api.github.com/users/ormsbee/gists{/gist_id}","starred_url":"https://api.github.com/users/ormsbee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ormsbee/subscriptions","organizations_url":"https://api.github.com/users/ormsbee/orgs","repos_url":"https://api.github.com/users/ormsbee/repos","events_url":"https://api.github.com/users/ormsbee/events{/privacy}","received_events_url":"https://api.github.com/users/ormsbee/received_events","type":"User","site_admin":false},"created_at":"2016-07-15T00:43:45Z","updated_at":"2016-07-15T00:43:45Z","body":"@nedbat, @doctoryes: Responded to comments, added tests. Another round please?"}}
{"actor":{"display_login":"ormsbee"}}