{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/5799","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/5799/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/5799/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/5799/events","html_url":"https://github.com/nodejs/node/issues/5799","id":142035958,"number":5799,"title":"What about SlowBuffer?","user":{"login":"ChALkeR","id":291301,"avatar_url":"https://avatars.githubusercontent.com/u/291301?v=3","gravatar_id":"","url":"https://api.github.com/users/ChALkeR","html_url":"https://github.com/ChALkeR","followers_url":"https://api.github.com/users/ChALkeR/followers","following_url":"https://api.github.com/users/ChALkeR/following{/other_user}","gists_url":"https://api.github.com/users/ChALkeR/gists{/gist_id}","starred_url":"https://api.github.com/users/ChALkeR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChALkeR/subscriptions","organizations_url":"https://api.github.com/users/ChALkeR/orgs","repos_url":"https://api.github.com/users/ChALkeR/repos","events_url":"https://api.github.com/users/ChALkeR/events{/privacy}","received_events_url":"https://api.github.com/users/ChALkeR/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/buffer","name":"buffer","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-03-19T07:10:27Z","updated_at":"2016-03-19T08:04:32Z","closed_at":null,"body":"SlowBuffer (and its documentation) has several issues atm:\r\n 1. The documentation states that it's a class and lists only one method of creating a SlowBuffer: `new SlowBuffer(size)`. On the other hand, all the tests, benchmarks, and even the code samples in the documentation exclude the `new` keyword and just call `SlowBuffer(size)`: [link](https://github.com/nodejs/node/blob/master/doc/api/buffer.markdown#class-slowbuffer). That has to be clarified in the docs.\r\n 2. `SlowBuffer(size)` is unsafe, pretty much like `Buffer(size)` was. It doesn't have accidential call problem, though — there is no `SlowBuffer(value)`. But it tells users that they should zero-fill the buffer themselves, which isn't very nice (the reasons were already discussed).\r\n 3. What is the real reason for it to be a separate class nowdays, when Buffer instances are created without the constructor functions, but using a class method?\r\n 4. *(Not `SlowBuffer`), btw, `Buffer(something)` documentation still includes the `new` keyword: [link](https://github.com/nodejs/node/blob/master/doc/api/buffer.markdown#class-buffer). It's deprecated though, and can perhaps be left like that.*\r\n 5. `Buffer.from('abc')` also returns a pooled buffer afaik. There is an unpooled counterpart to `Buffer.allocUnsafe(size)`, but not to all the other `Buffer` creation methods. Would anyone want those?\r\n\r\nSo, perhaps we should soft-deprecate SlowBuffer altogether and provide an API as `Buffer` methods, that would conform with `Buffer.from()` and `Buffer.alloc()`?\r\n\r\nI'm not yet sure how that would look like — it could be some options to the current methods, scary-looking names like `Buffer.allocSlow`/`Buffer.allocSlowUnsafe` or even something like `Buffer.Slow.alloc`/`Buffer.Slow.allocUnsafe`."},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/198663474","html_url":"https://github.com/nodejs/node/issues/5799#issuecomment-198663474","issue_url":"https://api.github.com/repos/nodejs/node/issues/5799","id":198663474,"user":{"login":"trevnorris","id":289174,"avatar_url":"https://avatars.githubusercontent.com/u/289174?v=3","gravatar_id":"","url":"https://api.github.com/users/trevnorris","html_url":"https://github.com/trevnorris","followers_url":"https://api.github.com/users/trevnorris/followers","following_url":"https://api.github.com/users/trevnorris/following{/other_user}","gists_url":"https://api.github.com/users/trevnorris/gists{/gist_id}","starred_url":"https://api.github.com/users/trevnorris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trevnorris/subscriptions","organizations_url":"https://api.github.com/users/trevnorris/orgs","repos_url":"https://api.github.com/users/trevnorris/repos","events_url":"https://api.github.com/users/trevnorris/events{/privacy}","received_events_url":"https://api.github.com/users/trevnorris/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T08:04:32Z","updated_at":"2016-03-19T08:04:32Z","body":"> Imo Buffer.allocSlowUnsafe is just too long and has too many adjectives in it, this is why I called it «scary-looking».\r\n\r\nHah. Sorry for the misinterpretation. It's late here. I'll go to bed now."}}