{"action":"created","issue":{"url":"https://api.github.com/repos/iojs/io.js/issues/1209","labels_url":"https://api.github.com/repos/iojs/io.js/issues/1209/labels{/name}","comments_url":"https://api.github.com/repos/iojs/io.js/issues/1209/comments","events_url":"https://api.github.com/repos/iojs/io.js/issues/1209/events","html_url":"https://github.com/iojs/io.js/pull/1209","id":63095870,"number":1209,"title":"string_decoder: optimize write()","user":{"login":"mscdex","id":54666,"avatar_url":"https://avatars.githubusercontent.com/u/54666?v=3","gravatar_id":"","url":"https://api.github.com/users/mscdex","html_url":"https://github.com/mscdex","followers_url":"https://api.github.com/users/mscdex/followers","following_url":"https://api.github.com/users/mscdex/following{/other_user}","gists_url":"https://api.github.com/users/mscdex/gists{/gist_id}","starred_url":"https://api.github.com/users/mscdex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mscdex/subscriptions","organizations_url":"https://api.github.com/users/mscdex/orgs","repos_url":"https://api.github.com/users/mscdex/repos","events_url":"https://api.github.com/users/mscdex/events{/privacy}","received_events_url":"https://api.github.com/users/mscdex/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-03-19T21:35:57Z","updated_at":"2015-03-20T20:10:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/iojs/io.js/pulls/1209","html_url":"https://github.com/iojs/io.js/pull/1209","diff_url":"https://github.com/iojs/io.js/pull/1209.diff","patch_url":"https://github.com/iojs/io.js/pull/1209.patch"},"body":"By limiting property getting/setting to only where they are\r\nabsolutely necessary, we can achieve greater performance\r\nespecially with small utf8 inputs and any size base64 inputs.\r\n\r\nascii/binary are unaffected.\r\n\r\nExample results for utf8 and base64 from the included benchmark:\r\n\r\n```\r\nmisc/string-decode.js encoding=utf8 inlen=32 chunk=16 n=250000: ./iojs: 1946800 ./iojs-io.js-4655521: 1654400 ........... 17.67%\r\nmisc/string-decode.js encoding=utf8 inlen=32 chunk=64 n=250000: ./iojs: 2838500 ./iojs-io.js-4655521: 2545000 ........... 11.53%\r\nmisc/string-decode.js encoding=utf8 inlen=32 chunk=256 n=250000: ./iojs: 2822200 ./iojs-io.js-4655521: 2522400 .......... 11.88%\r\nmisc/string-decode.js encoding=utf8 inlen=32 chunk=1024 n=250000: ./iojs: 2829100 ./iojs-io.js-4655521: 2507800 ......... 12.81%\r\nmisc/string-decode.js encoding=utf8 inlen=128 chunk=16 n=250000: ./iojs: 508720 ./iojs-io.js-4655521: 499830 ............. 1.78%\r\nmisc/string-decode.js encoding=utf8 inlen=128 chunk=64 n=250000: ./iojs: 1016400 ./iojs-io.js-4655521: 931340 ............ 9.13%\r\nmisc/string-decode.js encoding=utf8 inlen=128 chunk=256 n=250000: ./iojs: 1250200 ./iojs-io.js-4655521: 1179200 .......... 6.02%\r\nmisc/string-decode.js encoding=utf8 inlen=128 chunk=1024 n=250000: ./iojs: 1258600 ./iojs-io.js-4655521: 1193400 ......... 5.46%\r\nmisc/string-decode.js encoding=utf8 inlen=1024 chunk=16 n=250000: ./iojs: 64944 ./iojs-io.js-4655521: 64852 .............. 0.14%\r\nmisc/string-decode.js encoding=utf8 inlen=1024 chunk=64 n=250000: ./iojs: 134380 ./iojs-io.js-4655521: 133250 ............ 0.85%\r\nmisc/string-decode.js encoding=utf8 inlen=1024 chunk=256 n=250000: ./iojs: 178810 ./iojs-io.js-4655521: 176190 ........... 1.49%\r\nmisc/string-decode.js encoding=utf8 inlen=1024 chunk=1024 n=250000: ./iojs: 215380 ./iojs-io.js-4655521: 212140 .......... 1.52%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=32 chunk=16 n=250000: ./iojs: 407580 ./iojs-io.js-4655521: 307650 ...... 32.48%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=32 chunk=64 n=250000: ./iojs: 1422000 ./iojs-io.js-4655521: 1120100 .... 26.96%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=32 chunk=256 n=250000: ./iojs: 1416700 ./iojs-io.js-4655521: 1160400 ... 22.09%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=32 chunk=1024 n=250000: ./iojs: 1339300 ./iojs-io.js-4655521: 1140600 .. 17.42%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=128 chunk=16 n=250000: ./iojs: 93840 ./iojs-io.js-4655521: 84048 ....... 11.65%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=128 chunk=64 n=250000: ./iojs: 383150 ./iojs-io.js-4655521: 308310 ..... 24.28%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=128 chunk=256 n=250000: ./iojs: 1067600 ./iojs-io.js-4655521: 886690 ... 20.41%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=128 chunk=1024 n=250000: ./iojs: 1011700 ./iojs-io.js-4655521: 926400 ... 9.21%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=1024 chunk=16 n=250000: ./iojs: 13682 ./iojs-io.js-4655521: 10591 ...... 29.19%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=1024 chunk=64 n=250000: ./iojs: 48976 ./iojs-io.js-4655521: 39895 ...... 22.76%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=1024 chunk=256 n=250000: ./iojs: 141090 ./iojs-io.js-4655521: 120230 ... 17.35%\r\nmisc/string-decode.js encoding=base64-utf8 inlen=1024 chunk=1024 n=250000: ./iojs: 269880 ./iojs-io.js-4655521: 244070 .. 10.57%\r\nmisc/string-decode.js encoding=base64-ascii inlen=32 chunk=16 n=250000: ./iojs: 497550 ./iojs-io.js-4655521: 396600 ..... 25.45%\r\nmisc/string-decode.js encoding=base64-ascii inlen=32 chunk=64 n=250000: ./iojs: 1521700 ./iojs-io.js-4655521: 1174800 ... 29.52%\r\nmisc/string-decode.js encoding=base64-ascii inlen=32 chunk=256 n=250000: ./iojs: 1487500 ./iojs-io.js-4655521: 1174100 .. 26.69%\r\nmisc/string-decode.js encoding=base64-ascii inlen=32 chunk=1024 n=250000: ./iojs: 1401600 ./iojs-io.js-4655521: 1155800 . 21.27%\r\nmisc/string-decode.js encoding=base64-ascii inlen=128 chunk=16 n=250000: ./iojs: 142030 ./iojs-io.js-4655521: 114770 .... 23.75%\r\nmisc/string-decode.js encoding=base64-ascii inlen=128 chunk=64 n=250000: ./iojs: 499170 ./iojs-io.js-4655521: 396290 .... 25.96%\r\nmisc/string-decode.js encoding=base64-ascii inlen=128 chunk=256 n=250000: ./iojs: 1145200 ./iojs-io.js-4655521: 999490 .. 14.57%\r\nmisc/string-decode.js encoding=base64-ascii inlen=128 chunk=1024 n=250000: ./iojs: 1207200 ./iojs-io.js-4655521: 983240 . 22.77%\r\nmisc/string-decode.js encoding=base64-ascii inlen=1024 chunk=16 n=250000: ./iojs: 18163 ./iojs-io.js-4655521: 14729 ..... 23.31%\r\nmisc/string-decode.js encoding=base64-ascii inlen=1024 chunk=64 n=250000: ./iojs: 69888 ./iojs-io.js-4655521: 60726 ..... 15.09%\r\nmisc/string-decode.js encoding=base64-ascii inlen=1024 chunk=256 n=250000: ./iojs: 194780 ./iojs-io.js-4655521: 141810 .. 37.36%\r\nmisc/string-decode.js encoding=base64-ascii inlen=1024 chunk=1024 n=250000: ./iojs: 356430 ./iojs-io.js-4655521: 342270 .. 4.14%\r\n```"},"comment":{"url":"https://api.github.com/repos/iojs/io.js/issues/comments/84132262","html_url":"https://github.com/iojs/io.js/pull/1209#issuecomment-84132262","issue_url":"https://api.github.com/repos/iojs/io.js/issues/1209","id":84132262,"user":{"login":"chrisdickinson","id":37303,"avatar_url":"https://avatars.githubusercontent.com/u/37303?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdickinson","html_url":"https://github.com/chrisdickinson","followers_url":"https://api.github.com/users/chrisdickinson/followers","following_url":"https://api.github.com/users/chrisdickinson/following{/other_user}","gists_url":"https://api.github.com/users/chrisdickinson/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdickinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdickinson/subscriptions","organizations_url":"https://api.github.com/users/chrisdickinson/orgs","repos_url":"https://api.github.com/users/chrisdickinson/repos","events_url":"https://api.github.com/users/chrisdickinson/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdickinson/received_events","type":"User","site_admin":false},"created_at":"2015-03-20T20:10:20Z","updated_at":"2015-03-20T20:10:20Z","body":"This LGTM.\r\n\r\n> This should be implemented in C, we will need utf8 decoder in the future for buffer.toString() which is currently delegating to V8's utf8 decoder.\r\n\r\nWe'll still have to support this module if we move to a C decoder, so making it faster is probably worthwhile."}}