This repository has been archived by the owner on Oct 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'v8.3.0' into 8.3.0-proposal
2017-08-09 Node.js v8.3.0 (Current) Release Git-EVTag-v0-SHA512: a8c07aa1217584adb18eb9b40d2d4537d0089183e23522641743d6d1feff3984cfe474dfe2ddc7a5223424bc8721e54b344516b75525c8cfa1d87a8061116b8d
- Loading branch information
Showing
2,667 changed files
with
178,938 additions
and
103,347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
'use strict'; | ||
|
||
/* eslint-disable no-restricted-properties */ | ||
|
||
const common = require('../common.js'); | ||
const assert = require('assert'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
n: [5e2], | ||
len: [5e2], | ||
method: [ | ||
'deepEqual_primitiveOnly', | ||
'deepStrictEqual_primitiveOnly', | ||
'deepEqual_objectOnly', | ||
'deepStrictEqual_objectOnly', | ||
'deepEqual_mixed', | ||
'deepStrictEqual_mixed', | ||
'deepEqual_looseMatches', | ||
'notDeepEqual_primitiveOnly', | ||
'notDeepStrictEqual_primitiveOnly', | ||
'notDeepEqual_objectOnly', | ||
'notDeepStrictEqual_objectOnly', | ||
'notDeepEqual_mixed', | ||
'notDeepStrictEqual_mixed', | ||
'notDeepEqual_looseMatches', | ||
] | ||
}); | ||
|
||
function benchmark(method, n, values, values2) { | ||
const actual = new Map(values); | ||
// Prevent reference equal elements | ||
const deepCopy = JSON.parse(JSON.stringify(values2 ? values2 : values)); | ||
const expected = new Map(deepCopy); | ||
bench.start(); | ||
for (var i = 0; i < n; ++i) { | ||
method(actual, expected); | ||
} | ||
bench.end(n); | ||
} | ||
|
||
function main(conf) { | ||
const n = +conf.n; | ||
const len = +conf.len; | ||
|
||
const array = Array(len).fill(1); | ||
var values, values2; | ||
|
||
switch (conf.method) { | ||
case 'deepEqual_primitiveOnly': | ||
values = array.map((_, i) => [`str_${i}`, 123]); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_primitiveOnly': | ||
values = array.map((_, i) => [`str_${i}`, 123]); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_objectOnly': | ||
values = array.map((_, i) => [[`str_${i}`, 1], 123]); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_objectOnly': | ||
values = array.map((_, i) => [[`str_${i}`, 1], 123]); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_mixed': | ||
values = array.map((_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_mixed': | ||
values = array.map((_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_looseMatches': | ||
values = array.map((_, i) => [i, i]); | ||
values2 = values.slice().map((v) => [String(v[0]), String(v[1])]); | ||
benchmark(assert.deepEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_primitiveOnly': | ||
values = array.map((_, i) => [`str_${i}`, 123]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = ['w00t', 123]; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_primitiveOnly': | ||
values = array.map((_, i) => [`str_${i}`, 123]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = ['w00t', 123]; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_objectOnly': | ||
values = array.map((_, i) => [[`str_${i}`, 1], 123]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = [['w00t'], 123]; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_objectOnly': | ||
values = array.map((_, i) => [[`str_${i}`, 1], 123]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = [['w00t'], 123]; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_mixed': | ||
values = array.map((_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]); | ||
values2 = values.slice(0); | ||
values2[0] = ['w00t', 123]; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_mixed': | ||
values = array.map((_, i) => [i % 2 ? [`str_${i}`, 1] : `str_${i}`, 123]); | ||
values2 = values.slice(0); | ||
values2[0] = ['w00t', 123]; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_looseMatches': | ||
values = array.map((_, i) => [i, i]); | ||
values2 = values.slice().map((v) => [String(v[0]), String(v[1])]); | ||
values2[len - 1] = [String(len + 1), String(len + 1)]; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
default: | ||
throw new Error('Unsupported method'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
'use strict'; | ||
|
||
/* eslint-disable no-restricted-properties */ | ||
|
||
const common = require('../common.js'); | ||
const assert = require('assert'); | ||
|
||
const bench = common.createBenchmark(main, { | ||
n: [5e2], | ||
len: [5e2], | ||
method: [ | ||
'deepEqual_primitiveOnly', | ||
'deepStrictEqual_primitiveOnly', | ||
'deepEqual_objectOnly', | ||
'deepStrictEqual_objectOnly', | ||
'deepEqual_mixed', | ||
'deepStrictEqual_mixed', | ||
'deepEqual_looseMatches', | ||
'notDeepEqual_primitiveOnly', | ||
'notDeepStrictEqual_primitiveOnly', | ||
'notDeepEqual_objectOnly', | ||
'notDeepStrictEqual_objectOnly', | ||
'notDeepEqual_mixed', | ||
'notDeepStrictEqual_mixed', | ||
'notDeepEqual_looseMatches', | ||
] | ||
}); | ||
|
||
function benchmark(method, n, values, values2) { | ||
const actual = new Set(values); | ||
// Prevent reference equal elements | ||
const deepCopy = JSON.parse(JSON.stringify(values2 ? values2 : values)); | ||
const expected = new Set(deepCopy); | ||
bench.start(); | ||
for (var i = 0; i < n; ++i) { | ||
method(actual, expected); | ||
} | ||
bench.end(n); | ||
} | ||
|
||
function main(conf) { | ||
const n = +conf.n; | ||
const len = +conf.len; | ||
|
||
const array = Array(len).fill(1); | ||
|
||
var values, values2; | ||
|
||
switch (conf.method) { | ||
case 'deepEqual_primitiveOnly': | ||
values = array.map((_, i) => `str_${i}`); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_primitiveOnly': | ||
values = array.map((_, i) => `str_${i}`); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_objectOnly': | ||
values = array.map((_, i) => [`str_${i}`, null]); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_objectOnly': | ||
values = array.map((_, i) => [`str_${i}`, null]); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_mixed': | ||
values = array.map((_, i) => { | ||
return i % 2 ? [`str_${i}`, null] : `str_${i}`; | ||
}); | ||
benchmark(assert.deepEqual, n, values); | ||
break; | ||
case 'deepStrictEqual_mixed': | ||
values = array.map((_, i) => { | ||
return i % 2 ? [`str_${i}`, null] : `str_${i}`; | ||
}); | ||
benchmark(assert.deepStrictEqual, n, values); | ||
break; | ||
case 'deepEqual_looseMatches': | ||
values = array.map((_, i) => i); | ||
values2 = values.slice().map((v) => String(v)); | ||
benchmark(assert.deepEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_primitiveOnly': | ||
values = array.map((_, i) => `str_${i}`); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = 'w00t'; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_primitiveOnly': | ||
values = array.map((_, i) => `str_${i}`); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = 'w00t'; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_objectOnly': | ||
values = array.map((_, i) => [`str_${i}`, null]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = ['w00t']; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_objectOnly': | ||
values = array.map((_, i) => [`str_${i}`, null]); | ||
values2 = values.slice(0); | ||
values2[Math.floor(len / 2)] = ['w00t']; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_mixed': | ||
values = array.map((_, i) => { | ||
return i % 2 ? [`str_${i}`, null] : `str_${i}`; | ||
}); | ||
values2 = values.slice(); | ||
values2[0] = 'w00t'; | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
case 'notDeepStrictEqual_mixed': | ||
values = array.map((_, i) => { | ||
return i % 2 ? [`str_${i}`, null] : `str_${i}`; | ||
}); | ||
values2 = values.slice(); | ||
values2[0] = 'w00t'; | ||
benchmark(assert.notDeepStrictEqual, n, values, values2); | ||
break; | ||
case 'notDeepEqual_looseMatches': | ||
values = array.map((_, i) => i); | ||
values2 = values.slice().map((v) => String(v)); | ||
values2[len - 1] = String(len + 1); | ||
benchmark(assert.notDeepEqual, n, values, values2); | ||
break; | ||
default: | ||
throw new Error('Unsupported method'); | ||
} | ||
} |
Oops, something went wrong.