{"action":"created","issue":{"url":"https://api.github.com/repos/mcollina/msgpack5/issues/13","labels_url":"https://api.github.com/repos/mcollina/msgpack5/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/mcollina/msgpack5/issues/13/comments","events_url":"https://api.github.com/repos/mcollina/msgpack5/issues/13/events","html_url":"https://github.com/mcollina/msgpack5/pull/13","id":56941549,"number":13,"title":"Incomplete buffer","user":{"login":"shinichy","id":900172,"avatar_url":"https://avatars.githubusercontent.com/u/900172?v=3","gravatar_id":"","url":"https://api.github.com/users/shinichy","html_url":"https://github.com/shinichy","followers_url":"https://api.github.com/users/shinichy/followers","following_url":"https://api.github.com/users/shinichy/following{/other_user}","gists_url":"https://api.github.com/users/shinichy/gists{/gist_id}","starred_url":"https://api.github.com/users/shinichy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinichy/subscriptions","organizations_url":"https://api.github.com/users/shinichy/orgs","repos_url":"https://api.github.com/users/shinichy/repos","events_url":"https://api.github.com/users/shinichy/events{/privacy}","received_events_url":"https://api.github.com/users/shinichy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-08T06:47:39Z","updated_at":"2015-02-08T10:44:48Z","closed_at":"2015-02-08T09:47:15Z","pull_request":{"url":"https://api.github.com/repos/mcollina/msgpack5/pulls/13","html_url":"https://github.com/mcollina/msgpack5/pull/13","diff_url":"https://github.com/mcollina/msgpack5/pull/13.diff","patch_url":"https://github.com/mcollina/msgpack5/pull/13.patch"},"body":"Hi, thank you for pointing out the performance issue. I found that bl.duplicate was the cause so I refactored decode method not to use it. I introduced internal tryDecode(buf, offset) method to keep track of current offset as you suggested. If everything goes well, tryDecode returns {value: <result>, bytesConsumed: <bytes>}, so decode (buf) method actually calls bl.consume(bytesConsumed) at last step. Otherwise, bl is intact.\r\n\r\nI ran your benchmark with my new code again and it's as fast as master now!\r\n\r\n### new code\r\ntime 2726\r\ndecode/s 36683.78576669112\r\n\r\n### master\r\ntime 2706\r\ndecode/s 36954.91500369549"},"comment":{"url":"https://api.github.com/repos/mcollina/msgpack5/issues/comments/73405681","html_url":"https://github.com/mcollina/msgpack5/pull/13#issuecomment-73405681","issue_url":"https://api.github.com/repos/mcollina/msgpack5/issues/13","id":73405681,"user":{"login":"shinichy","id":900172,"avatar_url":"https://avatars.githubusercontent.com/u/900172?v=3","gravatar_id":"","url":"https://api.github.com/users/shinichy","html_url":"https://github.com/shinichy","followers_url":"https://api.github.com/users/shinichy/followers","following_url":"https://api.github.com/users/shinichy/following{/other_user}","gists_url":"https://api.github.com/users/shinichy/gists{/gist_id}","starred_url":"https://api.github.com/users/shinichy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinichy/subscriptions","organizations_url":"https://api.github.com/users/shinichy/orgs","repos_url":"https://api.github.com/users/shinichy/repos","events_url":"https://api.github.com/users/shinichy/events{/privacy}","received_events_url":"https://api.github.com/users/shinichy/received_events","type":"User","site_admin":false},"created_at":"2015-02-08T10:44:48Z","updated_at":"2015-02-08T10:44:48Z","body":"I agree. The header is not worth it anymore."}}