Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
Merge nodejs/master
Browse files Browse the repository at this point in the history
Merge afe68c1 as of 2017-08-14.
This is an automatically created merge. For any problems please
contact @kunalspathak.
  • Loading branch information
chakrabot committed Aug 18, 2017
2 parents dfeb1a2 + afe68c1 commit 40abd9c
Show file tree
Hide file tree
Showing 29 changed files with 646 additions and 195 deletions.
64 changes: 57 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,32 @@ The externally maintained libraries used by Node.js are:

- libuv, located at deps/uv, is licensed as follows:
"""
libuv is part of the Node project: http://nodejs.org/
libuv may be distributed alone under Node's license:
libuv is licensed for use as follows:

====
Copyright (c) 2015-present libuv project contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 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.
====

This license applies to parts of libuv originating from the
https://github.com/joyent/libuv repository:

====

Expand Down Expand Up @@ -537,7 +561,7 @@ The externally maintained libraries used by Node.js are:

- OpenSSL, located at deps/openssl, is licensed as follows:
"""
Copyright (c) 1998-2016 The OpenSSL Project. All rights reserved.
Copyright (c) 1998-2017 The OpenSSL Project. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -677,9 +701,9 @@ The externally maintained libraries used by Node.js are:
- zlib, located at deps/zlib, is licensed as follows:
"""
zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.8, April 28th, 2013
version 1.2.11, January 15th, 2017

Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
Expand Down Expand Up @@ -1017,8 +1041,7 @@ The externally maintained libraries used by Node.js are:

- ESLint, located at tools/eslint, is licensed as follows:
"""
ESLint
Copyright jQuery Foundation and other contributors, https://jquery.org/
Copyright JS Foundation and other contributors, https://js.foundation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -1070,3 +1093,30 @@ The externally maintained libraries used by Node.js are:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""

- nghttp2, located at deps/nghttp2, is licensed as follows:
"""
The MIT License

Copyright (c) 2012, 2014, 2015, 2016 Tatsuhiro Tsujikawa
Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN 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.
"""
35 changes: 29 additions & 6 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,62 @@
'use strict';
const common = require('../common.js');
const assert = require('assert');

const bench = common.createBenchmark(main, {
n: [1e3],
len: [1e2],
method: ['strict', 'nonstrict']
n: [1e5],
len: [1e2, 1e4],
method: [
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
]
});

function main(conf) {
const n = +conf.n;
const len = +conf.len;
var i;

const data = Buffer.allocUnsafe(len);
const data = Buffer.allocUnsafe(len + 1);
const actual = Buffer.alloc(len);
const expected = Buffer.alloc(len);
const expectedWrong = Buffer.alloc(len + 1);
data.copy(actual);
data.copy(expected);
data.copy(expectedWrong);

switch (conf.method) {
case 'strict':
case 'deepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
break;
case 'nonstrict':
case 'deepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
break;
case 'notDeepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'notDeepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
break;
default:
throw new Error('Unsupported method');
}
Expand Down
73 changes: 73 additions & 0 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

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

const bench = common.createBenchmark(main, {
n: [1e6],
size: [1e2, 1e3, 1e4],
method: [
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
]
});

function createObj(source, add = '') {
return source.map((n) => ({
foo: 'yarp',
nope: {
bar: `123${add}`,
a: [1, 2, 3],
baz: n
}
}));
}

function main(conf) {
const size = +conf.size;
// TODO: Fix this "hack"
const n = (+conf.n) / size;
var i;

const source = Array.apply(null, Array(size));
const actual = createObj(source);
const expected = createObj(source);
const expectedWrong = createObj(source, '4');

switch (conf.method) {
case 'deepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
break;
case 'deepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
break;
case 'notDeepEqual':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'notDeepStrictEqual':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
break;
default:
throw new Error('Unsupported method');
}
}
119 changes: 119 additions & 0 deletions benchmark/assert/deepequal-prims-and-objs-big-array-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
'use strict';

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

const primValues = {
'null': null,
'undefined': undefined,
'string': 'a',
'number': 1,
'boolean': true,
'object': { 0: 'a' },
'array': [1, 2, 3],
'new-array': new Array([1, 2, 3])
};

const bench = common.createBenchmark(main, {
prim: Object.keys(primValues),
n: [25],
len: [1e5],
method: [
'deepEqual_Array',
'deepStrictEqual_Array',
'notDeepEqual_Array',
'notDeepStrictEqual_Array',
'deepEqual_Set',
'deepStrictEqual_Set',
'notDeepEqual_Set',
'notDeepStrictEqual_Set'
]
});

function main(conf) {
const prim = primValues[conf.prim];
const n = +conf.n;
const len = +conf.len;
const actual = [];
const expected = [];
const expectedWrong = [];
var i;

for (var x = 0; x < len; x++) {
actual.push(prim);
expected.push(prim);
expectedWrong.push(prim);
}
expectedWrong.pop();
expectedWrong.push('b');

// Note: primitives are only added once to a set
const actualSet = new Set(actual);
const expectedSet = new Set(expected);
const expectedWrongSet = new Set(expectedWrong);

switch (conf.method) {
case 'deepEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actual, expected);
}
bench.end(n);
break;
case 'deepStrictEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actual, expected);
}
bench.end(n);
break;
case 'notDeepEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'notDeepStrictEqual_Array':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actual, expectedWrong);
}
bench.end(n);
break;
case 'deepEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.deepEqual(actualSet, expectedSet);
}
bench.end(n);
break;
case 'deepStrictEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
assert.deepStrictEqual(actualSet, expectedSet);
}
bench.end(n);
break;
case 'notDeepEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
// eslint-disable-next-line no-restricted-properties
assert.notDeepEqual(actualSet, expectedWrongSet);
}
bench.end(n);
break;
case 'notDeepStrictEqual_Set':
bench.start();
for (i = 0; i < n; ++i) {
assert.notDeepStrictEqual(actualSet, expectedWrongSet);
}
bench.end(n);
break;
default:
throw new Error('Unsupported method');
}
}
Loading

0 comments on commit 40abd9c

Please sign in to comment.