{"action":"opened","number":114,"pull_request":{"url":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114","id":69983868,"html_url":"https://github.com/msgpack/msgpack-ruby/pull/114","diff_url":"https://github.com/msgpack/msgpack-ruby/pull/114.diff","patch_url":"https://github.com/msgpack/msgpack-ruby/pull/114.patch","issue_url":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/114","number":114,"state":"open","locked":false,"title":"Serializing symbols using an ext type","user":{"login":"christopheraue","id":687174,"avatar_url":"https://avatars.githubusercontent.com/u/687174?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheraue","html_url":"https://github.com/christopheraue","followers_url":"https://api.github.com/users/christopheraue/followers","following_url":"https://api.github.com/users/christopheraue/following{/other_user}","gists_url":"https://api.github.com/users/christopheraue/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheraue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheraue/subscriptions","organizations_url":"https://api.github.com/users/christopheraue/orgs","repos_url":"https://api.github.com/users/christopheraue/repos","events_url":"https://api.github.com/users/christopheraue/events{/privacy}","received_events_url":"https://api.github.com/users/christopheraue/received_events","type":"User","site_admin":false},"body":"re #110 \r\n\r\n### How it's implementend\r\n\r\n1. Packers and Factorys got a flag `has_symbol_ext_type`.\r\n2. `has_symbol_ext_type` is set to `true` once an ext type for class `Symbol` is registered in their ext registry.\r\n3. When encountering a symbol during serialization, the `has_symbol_ext_type` flag is checked. If it's `false` the symbol is serialized as string. If it's `true` its serialized as ext type.\r\n4. `Symbol` got a default `#to_msgpack_ext` and `.from_msgpack_ext` so it does not need to be defined manually.\r\n\r\n### Performance\r\n\r\nThis below benchmark compares the *master* branch with the *[preserve_symbols](https://github.com/christopheraue/msgpack-ruby/tree/preserve_symbols)* branch. With no ext type registered both have identical run times. Once the symbol ext type is registered, the custom serialization kicks in on the *preserve_symbols* branch and drags down performance:\r\n\r\nColumns:\r\n\r\n* bench:\r\n  * `large_run`: 1 pack of an array of *count* symbols\r\n  * `multi_run`: *count* packs of 1 symbol\r\n* reg_type:\r\n  * `none`: packers has no ext type registered\r\n  * `symbol`: packer has an ext type registered for symbols\r\n\r\nBenchmark:\r\n\r\n    +------------+-----------+----------+------------------+-----------+----------+-----------+-----------+\r\n    | :bench     | :reg_type | :count   | :branch          | :user     | :system  | :total    | :real     |\r\n    +------------+-----------+----------+------------------+-----------+----------+-----------+-----------+\r\n    | :large_run | :none     |   100000 | master           |  0.000000 | 0.000000 |  0.000000 |  0.002413 |\r\n    | :large_run | :none     |   100000 | preserve_symbols |  0.000000 | 0.000000 |  0.000000 |  0.002356 |\r\n    | :large_run | :none     |  1000000 | master           |  0.030000 | 0.000000 |  0.030000 |  0.031178 |\r\n    | :large_run | :none     |  1000000 | preserve_symbols |  0.030000 | 0.000000 |  0.030000 |  0.029986 |\r\n    | :large_run | :none     | 10000000 | master           |  0.820000 | 0.000000 |  0.820000 |  0.820698 |\r\n    | :large_run | :none     | 10000000 | preserve_symbols |  0.810000 | 0.010000 |  0.820000 |  0.805589 |\r\n    | :large_run | :symbol   |   100000 | master           |  0.000000 | 0.000000 |  0.000000 |  0.004980 |\r\n    | :large_run | :symbol   |   100000 | preserve_symbols |  0.070000 | 0.000000 |  0.070000 |  0.070618 |\r\n    | :large_run | :symbol   |  1000000 | master           |  0.030000 | 0.000000 |  0.030000 |  0.033774 |\r\n    | :large_run | :symbol   |  1000000 | preserve_symbols |  0.670000 | 0.010000 |  0.680000 |  0.671461 |\r\n    | :large_run | :symbol   | 10000000 | master           |  0.890000 | 0.000000 |  0.890000 |  0.896243 |\r\n    | :large_run | :symbol   | 10000000 | preserve_symbols |  9.960000 | 0.000000 |  9.960000 |  9.954431 |\r\n    | :multi_run | :none     |   100000 | master           |  0.010000 | 0.000000 |  0.010000 |  0.007190 |\r\n    | :multi_run | :none     |   100000 | preserve_symbols |  0.010000 | 0.000000 |  0.010000 |  0.007214 |\r\n    | :multi_run | :none     |  1000000 | master           |  0.080000 | 0.000000 |  0.080000 |  0.078755 |\r\n    | :multi_run | :none     |  1000000 | preserve_symbols |  0.080000 | 0.000000 |  0.080000 |  0.079481 |\r\n    | :multi_run | :none     | 10000000 | master           |  2.040000 | 0.000000 |  2.040000 |  2.038135 |\r\n    | :multi_run | :none     | 10000000 | preserve_symbols |  2.050000 | 0.000000 |  2.050000 |  2.043865 |\r\n    | :multi_run | :symbol   |   100000 | master           |  0.010000 | 0.000000 |  0.010000 |  0.017638 |\r\n    | :multi_run | :symbol   |   100000 | preserve_symbols |  0.080000 | 0.010000 |  0.090000 |  0.083361 |\r\n    | :multi_run | :symbol   |  1000000 | master           |  0.110000 | 0.000000 |  0.110000 |  0.110694 |\r\n    | :multi_run | :symbol   |  1000000 | preserve_symbols |  0.830000 | 0.000000 |  0.830000 |  0.829279 |\r\n    | :multi_run | :symbol   | 10000000 | master           |  2.180000 | 0.010000 |  2.190000 |  2.186607 |\r\n    | :multi_run | :symbol   | 10000000 | preserve_symbols | 11.130000 | 0.030000 | 11.160000 | 11.167616 |\r\n    +------------+-----------+----------+------------------+-----------+----------+-----------+-----------+\r\n\r\nTo run this, check out the [preserve_symbols](https://github.com/christopheraue/msgpack-ruby/tree/preserve_symbols) branch and execute `bench/run_symbols.sh`.","created_at":"2016-05-13T11:52:14Z","updated_at":"2016-05-13T11:52:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114/commits","review_comments_url":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114/comments","review_comment_url":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/114/comments","statuses_url":"https://api.github.com/repos/msgpack/msgpack-ruby/statuses/a0c179aa51e6bf83e94f678d2590e9245a2efbb7","head":{"label":"christopheraue:preserve_symbols","ref":"preserve_symbols","sha":"a0c179aa51e6bf83e94f678d2590e9245a2efbb7","user":{"login":"christopheraue","id":687174,"avatar_url":"https://avatars.githubusercontent.com/u/687174?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheraue","html_url":"https://github.com/christopheraue","followers_url":"https://api.github.com/users/christopheraue/followers","following_url":"https://api.github.com/users/christopheraue/following{/other_user}","gists_url":"https://api.github.com/users/christopheraue/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheraue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheraue/subscriptions","organizations_url":"https://api.github.com/users/christopheraue/orgs","repos_url":"https://api.github.com/users/christopheraue/repos","events_url":"https://api.github.com/users/christopheraue/events{/privacy}","received_events_url":"https://api.github.com/users/christopheraue/received_events","type":"User","site_admin":false},"repo":{"id":58725223,"name":"msgpack-ruby","full_name":"christopheraue/msgpack-ruby","owner":{"login":"christopheraue","id":687174,"avatar_url":"https://avatars.githubusercontent.com/u/687174?v=3","gravatar_id":"","url":"https://api.github.com/users/christopheraue","html_url":"https://github.com/christopheraue","followers_url":"https://api.github.com/users/christopheraue/followers","following_url":"https://api.github.com/users/christopheraue/following{/other_user}","gists_url":"https://api.github.com/users/christopheraue/gists{/gist_id}","starred_url":"https://api.github.com/users/christopheraue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopheraue/subscriptions","organizations_url":"https://api.github.com/users/christopheraue/orgs","repos_url":"https://api.github.com/users/christopheraue/repos","events_url":"https://api.github.com/users/christopheraue/events{/privacy}","received_events_url":"https://api.github.com/users/christopheraue/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/christopheraue/msgpack-ruby","description":"MessagePack implementation for Ruby / msgpack.org[Ruby]","fork":true,"url":"https://api.github.com/repos/christopheraue/msgpack-ruby","forks_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/forks","keys_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/teams","hooks_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/hooks","issue_events_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/events","assignees_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/tags","blobs_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/languages","stargazers_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/stargazers","contributors_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/contributors","subscribers_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/subscribers","subscription_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/subscription","commits_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/merges","archive_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/downloads","issues_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/labels{/name}","releases_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/christopheraue/msgpack-ruby/deployments","created_at":"2016-05-13T09:44:41Z","updated_at":"2016-05-13T09:44:42Z","pushed_at":"2016-05-13T09:55:15Z","git_url":"git://github.com/christopheraue/msgpack-ruby.git","ssh_url":"git@github.com:christopheraue/msgpack-ruby.git","clone_url":"https://github.com/christopheraue/msgpack-ruby.git","svn_url":"https://github.com/christopheraue/msgpack-ruby","homepage":"http://msgpack.org/","size":5879,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"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":"msgpack:master","ref":"master","sha":"073e4ea07e3ccf602ca69dbd1dbacdeb6f231d41","user":{"login":"msgpack","id":198264,"avatar_url":"https://avatars.githubusercontent.com/u/198264?v=3","gravatar_id":"","url":"https://api.github.com/users/msgpack","html_url":"https://github.com/msgpack","followers_url":"https://api.github.com/users/msgpack/followers","following_url":"https://api.github.com/users/msgpack/following{/other_user}","gists_url":"https://api.github.com/users/msgpack/gists{/gist_id}","starred_url":"https://api.github.com/users/msgpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msgpack/subscriptions","organizations_url":"https://api.github.com/users/msgpack/orgs","repos_url":"https://api.github.com/users/msgpack/repos","events_url":"https://api.github.com/users/msgpack/events{/privacy}","received_events_url":"https://api.github.com/users/msgpack/received_events","type":"Organization","site_admin":false},"repo":{"id":2479813,"name":"msgpack-ruby","full_name":"msgpack/msgpack-ruby","owner":{"login":"msgpack","id":198264,"avatar_url":"https://avatars.githubusercontent.com/u/198264?v=3","gravatar_id":"","url":"https://api.github.com/users/msgpack","html_url":"https://github.com/msgpack","followers_url":"https://api.github.com/users/msgpack/followers","following_url":"https://api.github.com/users/msgpack/following{/other_user}","gists_url":"https://api.github.com/users/msgpack/gists{/gist_id}","starred_url":"https://api.github.com/users/msgpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msgpack/subscriptions","organizations_url":"https://api.github.com/users/msgpack/orgs","repos_url":"https://api.github.com/users/msgpack/repos","events_url":"https://api.github.com/users/msgpack/events{/privacy}","received_events_url":"https://api.github.com/users/msgpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/msgpack/msgpack-ruby","description":"MessagePack implementation for Ruby / msgpack.org[Ruby]","fork":false,"url":"https://api.github.com/repos/msgpack/msgpack-ruby","forks_url":"https://api.github.com/repos/msgpack/msgpack-ruby/forks","keys_url":"https://api.github.com/repos/msgpack/msgpack-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/msgpack/msgpack-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/msgpack/msgpack-ruby/teams","hooks_url":"https://api.github.com/repos/msgpack/msgpack-ruby/hooks","issue_events_url":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/msgpack/msgpack-ruby/events","assignees_url":"https://api.github.com/repos/msgpack/msgpack-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/msgpack/msgpack-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/msgpack/msgpack-ruby/tags","blobs_url":"https://api.github.com/repos/msgpack/msgpack-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/msgpack/msgpack-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/msgpack/msgpack-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/msgpack/msgpack-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/msgpack/msgpack-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/msgpack/msgpack-ruby/languages","stargazers_url":"https://api.github.com/repos/msgpack/msgpack-ruby/stargazers","contributors_url":"https://api.github.com/repos/msgpack/msgpack-ruby/contributors","subscribers_url":"https://api.github.com/repos/msgpack/msgpack-ruby/subscribers","subscription_url":"https://api.github.com/repos/msgpack/msgpack-ruby/subscription","commits_url":"https://api.github.com/repos/msgpack/msgpack-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/msgpack/msgpack-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/msgpack/msgpack-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/msgpack/msgpack-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/msgpack/msgpack-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/msgpack/msgpack-ruby/merges","archive_url":"https://api.github.com/repos/msgpack/msgpack-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/msgpack/msgpack-ruby/downloads","issues_url":"https://api.github.com/repos/msgpack/msgpack-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/msgpack/msgpack-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/msgpack/msgpack-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/msgpack/msgpack-ruby/labels{/name}","releases_url":"https://api.github.com/repos/msgpack/msgpack-ruby/releases{/id}","deployments_url":"https://api.github.com/repos/msgpack/msgpack-ruby/deployments","created_at":"2011-09-29T04:10:15Z","updated_at":"2016-05-05T00:28:37Z","pushed_at":"2016-05-10T07:30:33Z","git_url":"git://github.com/msgpack/msgpack-ruby.git","ssh_url":"git@github.com:msgpack/msgpack-ruby.git","clone_url":"https://github.com/msgpack/msgpack-ruby.git","svn_url":"https://github.com/msgpack/msgpack-ruby","homepage":"http://msgpack.org/","size":6581,"stargazers_count":415,"watchers_count":415,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":67,"mirror_url":null,"open_issues_count":6,"forks":67,"open_issues":6,"watchers":415,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114"},"html":{"href":"https://github.com/msgpack/msgpack-ruby/pull/114"},"issue":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/114"},"comments":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/msgpack/msgpack-ruby/statuses/a0c179aa51e6bf83e94f678d2590e9245a2efbb7"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":2,"additions":159,"deletions":3,"changed_files":10}}