Skip to content

Conversation

@cjihrig
Copy link
Contributor

This commit introduces a nop function that is used as the Writable.prototype.write() callback when one is not provided. This saves on function and closure creation.

This commit introduces a nop function that is used as the Writable.prototype.write() callback when one is not provided. This saves on function and closure creation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/nop/noop/ ? I have only ever seen the latter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both exist in core.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I personally prefer noop, but nop seems to be used in core too.

@bnoordhuis
Copy link
Member

LGTM but I suggest rewording this:

This saves on function and closure creation.

To:

This saves on function object creation.

Empty functions don't allocate a closure context (they don't close over anything) but they still create a function object (when passed around as values.)

@cjihrig
Copy link
ContributorAuthor

OK, I will reword it.

cjihrig added a commit that referenced this pull request Jan 23, 2015
This commit introduces a nop function that is used as the Writable.prototype.write() callback when one is not provided. This saves on function object creation. PR-URL: #564 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
@cjihrig
Copy link
ContributorAuthor

Landed in 40ffed8

@cjihrigcjihrig closed this Jan 23, 2015
@cjihrigcjihrig deleted the nop branch January 23, 2015 14:48
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@cjihrig@bnoordhuis@Fishrock123