Skip to content
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

Backport: repl: don't override all internal repl defaults #9774

Closed
wants to merge 2 commits into from

Conversation

cjihrig
Copy link
Contributor

@cjihrig cjihrig commented Nov 23, 2016

This is a backport of #7826 to v4.

R= @thealphanerd

This commit adds a function to test/common.js that allows
additional global variables to be whitelisted in a test.

PR-URL: nodejs#7826
Reviewed-By: James M Snell <jasnell@gmail.com>
The createInternalRepl() module accepts an options object as an
argument. However, if one is provided, it overrides all of the
default options. This commit applies the options object to the
defaults, only changing the values that are explicitly set.

PR-URL: nodejs#7826
Reviewed-By: James M Snell <jasnell@gmail.com>
@nodejs-github-bot nodejs-github-bot added repl Issues and PRs related to the REPL subsystem. v4.x labels Nov 23, 2016
@@ -19,11 +20,11 @@ function createRepl(env, opts, cb) {
cb = opts;
opts = null;
}
opts = opts || {
opts = util._extend({
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why you wouldn't just use Object.assign here. Looking at the source of util._extend it looks to be identical. What am I missing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object.assign() was shown to be slower in a few previous issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

If not in critical path, May be Object.assign() is ok enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a backport, so I don't think it's a good idea to change things here.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 If you have problem with implementation fix on master and it can come in another backport

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the info. Just for the record, I asked out of curiosity - not because I expected it to change. I had no idea that Object.assign was slower. To see for myself, I ran some tests and also found that to be the case. Thanks for the clarification.

@JacksonTian
Copy link
Contributor

LGTM

@MylesBorins
Copy link
Contributor

MylesBorins commented Dec 13, 2016

landed in 7b4268b...698bf2e

@cjihrig cjihrig deleted the 7826bp branch December 20, 2016 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants