Skip to content
This repository has been archived by the owner on Jun 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #362 from mykmelez/merge-node
Browse files Browse the repository at this point in the history
merge Node
  • Loading branch information
mykmelez committed Feb 13, 2017
2 parents a3a7b80 + bab7816 commit 5fb635b
Show file tree
Hide file tree
Showing 371 changed files with 7,931 additions and 10,808 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ env:
es6: true

parserOptions:
ecmaVersion: 2016
ecmaVersion: 2017

rules:
# Possible Errors
Expand Down Expand Up @@ -40,6 +40,7 @@ rules:
no-octal: 2
no-redeclare: 2
no-self-assign: 2
no-throw-literal: 2
no-unused-labels: 2
no-useless-call: 2
no-useless-escape: 2
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ Running `make test`/`vcbuild test` will run the linter as well unless one or
more tests fail.

If you want to run the linter without running tests, use
`make lint`/`vcbuild lint`.
`make lint`/`vcbuild jslint`. At this time, only JavaScript linting is
available on Windows. `make lint` on POSIX will run both JavaScript linting and
C++ linting.

If you are updating tests and just want to run a single test to check it, you
can use this syntax to run it exactly as the test harness would:
Expand Down
17 changes: 0 additions & 17 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -1071,23 +1071,6 @@ The externally maintained libraries used by Node.js are:
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

- node-weak, located at test/gc/node_modules/weak, is licensed as follows:
"""
Copyright (c) 2011, Ben Noordhuis <info@bnoordhuis.nl>

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""

- v8_inspector, located at deps/v8_inspector/third_party/v8_inspector, is licensed as follows:
"""
// Copyright 2015 The Chromium Authors. All rights reserved.
Expand Down
29 changes: 22 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ test-parallel: all
test-valgrind: all
$(PYTHON) tools/test.py --mode=release --valgrind sequential parallel message

test/gc/node_modules/weak/build/Release/weakref.node: $(NODE_EXE)
test/gc/build/Release/binding.node: \
$(NODE_EXE) test/gc/binding.cc test/gc/binding.gyp
$(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \
--python="$(PYTHON)" \
--directory="$(shell pwd)/test/gc/node_modules/weak" \
--directory="$(shell pwd)/test/gc" \
--nodedir="$(shell pwd)"

# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
Expand Down Expand Up @@ -188,12 +189,21 @@ test/addons/.buildstamp: config.gypi \
# TODO(bnoordhuis) Force rebuild after gyp update.
build-addons: $(NODE_EXE) test/addons/.buildstamp

test-gc: all test/gc/node_modules/weak/build/Release/weakref.node
ifeq ($(OSTYPE),$(filter $(OSTYPE),darwin aix))
XARGS = xargs
else
XARGS = xargs -r
endif
clear-stalled:
ps awwx | grep Release/node | grep -v grep | cat
ps awwx | grep Release/node | grep -v grep | awk '{print $$1}' | $(XARGS) kill

test-gc: all test/gc/build/Release/binding.node
$(PYTHON) tools/test.py --mode=release gc

test-build: | all build-addons

test-all: test-build test/gc/node_modules/weak/build/Release/weakref.node
test-all: test-build test/gc/build/Release/binding.node
$(PYTHON) tools/test.py --mode=debug,release

test-all-valgrind: test-build
Expand All @@ -210,13 +220,13 @@ test-ci-native: | test/addons/.buildstamp
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)

# This target should not use a native compiler at all
test-ci-js:
test-ci-js: | clear-stalled
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
$(TEST_CI_ARGS) $(CI_JS_SUITES)

test-ci: LOGLEVEL := info
test-ci: | build-addons
test-ci: | clear-stalled build-addons
out/Release/cctest --gtest_output=tap:cctest.tap
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
--mode=release --flaky-tests=$(FLAKY_TESTS) \
Expand Down Expand Up @@ -246,6 +256,10 @@ test-debugger: all
test-inspector: all
$(PYTHON) tools/test.py inspector

test-node-inspect: $(NODE_EXE)
USE_EMBEDDED_NODE_INSPECT=1 $(NODE) tools/test-npm-package \
--install deps/node-inspect test

test-tick-processor: all
$(PYTHON) tools/test.py tick-processor

Expand Down Expand Up @@ -728,6 +742,7 @@ CPPLINT_FILES = $(filter-out $(CPPLINT_EXCLUDE), $(wildcard \
test/addons/*/*.h \
test/cctest/*.cc \
test/cctest/*.h \
test/gc/binding.cc \
tools/icu/*.cc \
tools/icu/*.h \
))
Expand Down Expand Up @@ -764,4 +779,4 @@ endif
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
test-v8-benchmarks test-v8-all v8 lint-ci bench-ci jslint-ci doc-only \
$(TARBALL)-headers test-ci test-ci-native test-ci-js build-ci
$(TARBALL)-headers test-ci test-ci-native test-ci-js build-ci clear-stalled
8 changes: 4 additions & 4 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ either [`wrk`][wrk] or [`autocannon`][autocannon].
path, hence if you want to compare two HTTP benchmark runs make sure that the
Node version in the path is not altered.

`wrk` may be available through your preferred package manger. If not, you can
`wrk` may be available through your preferred package manager. If not, you can
easily build it [from source][wrk] via `make`.

By default `wrk` will be used as benchmarker. If it is not available
Expand Down Expand Up @@ -55,8 +55,8 @@ In the event you get a message that you need to select a CRAN mirror first.

You can specify a mirror by adding in the repo parameter.

If we used the "http://cran.us.r-project.org" mirror, it could look somehting like
this:
If we used the "http://cran.us.r-project.org" mirror, it could look something
like this:

```R
install.packages("ggplot2", repo="http://cran.us.r-project.org")
Expand Down Expand Up @@ -180,7 +180,7 @@ to be no improvements, then there shouldn't be any stars.

**A word of caution:** Statistics is not a foolproof tool. If a benchmark shows
a statistical significant difference, there is a 5% risk that this
difference doesn't actually exists. For a single benchmark this is not an
difference doesn't actually exist. For a single benchmark this is not an
issue. But when considering 20 benchmarks it's normal that one of them
will show significance, when it shouldn't. A possible solution is to instead
consider at least two stars (`**`) as the threshold, in that case the risk
Expand Down
59 changes: 59 additions & 0 deletions benchmark/es/spread-bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
'use strict';

const common = require('../common.js');
const assert = require('assert');

const bench = common.createBenchmark(main, {
method: ['apply', 'spread', 'call-spread'],
count: [5, 10, 20],
context: ['context', 'null'],
rest: [0, 1],
millions: [5]
});

function makeTest(count, rest) {
if (rest) {
return function test(...args) {
assert.strictEqual(count, args.length);
};
} else {
return function test() {
assert.strictEqual(count, arguments.length);
};
}
}

function main(conf) {
const n = +conf.millions * 1e6;
const ctx = conf.context === 'context' ? {} : null;
var fn = makeTest(conf.count, conf.rest);
const args = new Array(conf.count);
var i;
for (i = 0; i < conf.count; i++)
args[i] = i;

switch (conf.method) {
case 'apply':
bench.start();
for (i = 0; i < n; i++)
fn.apply(ctx, args);
bench.end(n / 1e6);
break;
case 'spread':
if (ctx !== null)
fn = fn.bind(ctx);
bench.start();
for (i = 0; i < n; i++)
fn(...args);
bench.end(n / 1e6);
break;
case 'call-spread':
bench.start();
for (i = 0; i < n; i++)
fn.call(ctx, ...args);
bench.end(n / 1e6);
break;
default:
throw new Error('Unexpected method');
}
}
2 changes: 1 addition & 1 deletion benchmark/url/legacy-vs-whatwg-url-parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function useLegacy(n, input) {
}

function useWHATWG(n, input) {
var noDead = url.parse(input);
var noDead = new URL(input);
bench.start();
for (var i = 0; i < n; i += 1) {
noDead = new URL(input);
Expand Down
62 changes: 62 additions & 0 deletions benchmark/url/legacy-vs-whatwg-url-searchparams-parse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');

const inputs = {
noencode: 'foo=bar&baz=quux&xyzzy=thud',
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d',
encodefake: 'foo=%©ar&baz=%A©uux&xyzzy=%©ud',
encodelast: 'foo=bar&baz=quux&xyzzy=thu%64',
multicharsep: 'foo=bar&&&&&&&&&&baz=quux&&&&&&&&&&xyzzy=thud',
multivalue: 'foo=bar&foo=baz&foo=quux&quuy=quuz',
multivaluemany: 'foo=bar&foo=baz&foo=quux&quuy=quuz&foo=abc&foo=def&' +
'foo=ghi&foo=jkl&foo=mno&foo=pqr&foo=stu&foo=vwxyz',
manypairs: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z'
};

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
method: ['legacy', 'whatwg'],
n: [1e5]
});

function useLegacy(n, input) {
querystring.parse(input);
bench.start();
for (var i = 0; i < n; i += 1) {
querystring.parse(input);
}
bench.end(n);
}

function useWHATWG(n, input) {
new URLSearchParams(input);
bench.start();
for (var i = 0; i < n; i += 1) {
new URLSearchParams(input);
}
bench.end(n);
}

function main(conf) {
const type = conf.type;
const n = conf.n | 0;
const method = conf.method;

const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
}

switch (method) {
case 'legacy':
useLegacy(n, input);
break;
case 'whatwg':
useWHATWG(n, input);
break;
default:
throw new Error('Unknown method');
}
}
64 changes: 64 additions & 0 deletions benchmark/url/legacy-vs-whatwg-url-searchparams-serialize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
'use strict';
const common = require('../common.js');
const { URLSearchParams } = require('url');
const querystring = require('querystring');

const inputs = {
noencode: 'foo=bar&baz=quux&xyzzy=thud',
encodemany: '%66%6F%6F=bar&%62%61%7A=quux&xyzzy=%74h%75d',
encodefake: 'foo=%©ar&baz=%A©uux&xyzzy=%©ud',
encodelast: 'foo=bar&baz=quux&xyzzy=thu%64',
multicharsep: 'foo=bar&&&&&&&&&&baz=quux&&&&&&&&&&xyzzy=thud',
multivalue: 'foo=bar&foo=baz&foo=quux&quuy=quuz',
multivaluemany: 'foo=bar&foo=baz&foo=quux&quuy=quuz&foo=abc&foo=def&' +
'foo=ghi&foo=jkl&foo=mno&foo=pqr&foo=stu&foo=vwxyz',
manypairs: 'a&b&c&d&e&f&g&h&i&j&k&l&m&n&o&p&q&r&s&t&u&v&w&x&y&z'
};

const bench = common.createBenchmark(main, {
type: Object.keys(inputs),
method: ['legacy', 'whatwg'],
n: [1e5]
});

function useLegacy(n, input, prop) {
const obj = querystring.parse(input);
querystring.stringify(obj);
bench.start();
for (var i = 0; i < n; i += 1) {
querystring.stringify(obj);
}
bench.end(n);
}

function useWHATWG(n, input, prop) {
const obj = new URLSearchParams(input);
obj.toString();
bench.start();
for (var i = 0; i < n; i += 1) {
obj.toString();
}
bench.end(n);
}

function main(conf) {
const type = conf.type;
const n = conf.n | 0;
const method = conf.method;

const input = inputs[type];
if (!input) {
throw new Error('Unknown input type');
}

switch (method) {
case 'legacy':
useLegacy(n, input);
break;
case 'whatwg':
useWHATWG(n, input);
break;
default:
throw new Error('Unknown method');
}
}
31 changes: 0 additions & 31 deletions benchmark/url/url-searchparams-parse.js

This file was deleted.

Loading

0 comments on commit 5fb635b

Please sign in to comment.