-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buffer: implement iterable
interface
#525
Conversation
This makes possible to use `for..of` loop with buffers. Also related `keys`, `values` and `entries` methods are added for feature parity with `Uint8Array`.
Benchmark results:
|
Basically it's 30 times slower. Not that bad. Eventually will become faster: https://code.google.com/p/v8/issues/detail?id=3822 Looks like functions with
|
Another one for 1.1.0 perhaps |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vkurchatkin Can you drop the license boilerplate? The TC recently decided to do away with it.
LGTM but like @rvagg said, on hold for 1.1. The strategy for minor version bumps will be discussed in tomorrow's TC meeting. But thanks for doing this, Vladimir! |
@vkurchatkin If you're feeling ambitious, please also send a PR to the npm module |
9aba596
to
d67e2f7
Compare
@feross I'll look into it, but a quick test shows that it works already in Chrome since |
added one more benchmark case which use iterator, but not var iter = buffer[Symbol.iterator]();
var cur = iter.next();
while (!cur.done) {
console.log(cur.value);
cur = iter.next();
} Results:
I think we can expect at least as much speed with |
this was tagged with tc-agenda but I'm not sure we properly covered it, @bnoordhuis your call as to whether the tag is removed or left for next meeting bundled with further versioning discussion |
#625 being merged has forced us to a semver-minor situation so this could probably be merged now so it makes it in to 1.1.0, I don't see any -1s here. |
This makes possible to use `for..of` loop with buffers. Also related `keys`, `values` and `entries` methods are added for feature parity with `Uint8Array`. PR-URL: #525 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
landed in 45d8d9f |
See #204
R=@bnoordhuis