Skip to content

Commit da4c816

Browse files
committed
more cleanup
1 parent 9ecc357 commit da4c816

File tree

4 files changed

+33
-65
lines changed

4 files changed

+33
-65
lines changed

build.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ if (!force) {
5656

5757
// Build it
5858
function build() {
59-
if (process.versions.electron) {
60-
args.push('--target='+ process.versions.electron, '--dist-url=https://atom.io/download/atom-shell');
61-
}
6259
cp.spawn(
6360
'node-gyp',
6461
['rebuild'].concat(args),
@@ -106,9 +103,4 @@ function afterBuild() {
106103
}
107104
fs.renameSync(targetPath, installPath);
108105
console.log('Installed in `'+ installPath+ '`');
109-
if (process.versions.electron) {
110-
process.nextTick(function() {
111-
require('electron').app.quit();
112-
});
113-
}
114106
}

test.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ function runTest(test, cb) {
1111
}
1212
env.NODE_PATH = __dirname;
1313
var args = [];
14-
if (process.versions.modules >= 57 && process.versions.modules < 59) {
15-
// Node v8 requires forcing async hook checks. In Node v9 (>=59) and beyond,
16-
// async hooks checks are on by default (and the param no longer exists).
17-
args.push('--force-async-hooks-checks');
18-
}
1914
args.push(path.join('test', test));
2015
var proc = spawn(process.execPath, args, { env: env });
2116
proc.stdout.setEncoding('utf8');

test/async-hooks.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
'use strict';
2-
// This test must be run with --force-async-hooks-checks
3-
if (process.versions.modules < 57) {
4-
console.log('pass');
5-
return;
6-
}
2+
73
const { AsyncResource } = require('async_hooks');
84
const Fiber = require('fibers');
95

@@ -13,15 +9,7 @@ class TestResource extends AsyncResource {
139
}
1410

1511
run(cb) {
16-
// In the v8 API, only emitBefore() and emitAfter() are available
17-
if (process.versions.modules < 59) {
18-
this.emitBefore();
19-
cb();
20-
this.emitAfter();
21-
} else {
22-
// In v9 and higher, emitBefore() and emitAfter() are deperecated in favor of runInAsyncScope().
23-
this.runInAsyncScope(cb);
24-
}
12+
this.runInAsyncScope(cb);
2513
}
2614
}
2715

test/cleanup.js

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,42 @@
11
"use strict";
22
var Fiber = require('fibers');
33
Fiber.poolSize = 100;
4-
let v8 = /^([0-9]+)\.([0-9]+)/.exec(process.versions.v8);
5-
if (v8[1] > 4 || (v8[1] == 4 && v8[2] >= 10)) {
64

7-
// Vague benchmark of fiber performance, lower is better
8-
function bench() {
9-
var d = new Date;
10-
for (var ii = 0; ii < 100; ++ii) {
11-
var fibers = [];
12-
for (var jj = 0; jj < Fiber.poolSize; ++jj) {
13-
var fiber = Fiber(function() {
14-
Fiber.yield();
15-
});
16-
fiber.run();
17-
fibers.push(fiber);
18-
}
19-
fibers.map(function(fiber) {
20-
fiber.run();
5+
// Vague benchmark of fiber performance, lower is better
6+
function bench() {
7+
var d = new Date;
8+
for (var ii = 0; ii < 100; ++ii) {
9+
var fibers = [];
10+
for (var jj = 0; jj < Fiber.poolSize; ++jj) {
11+
var fiber = Fiber(function() {
12+
Fiber.yield();
2113
});
14+
fiber.run();
15+
fibers.push(fiber);
2216
}
23-
return new Date - d;
24-
}
25-
26-
// Run initial benchmark
27-
var ts1 = Math.min(bench(), bench());
28-
29-
// Dirty up isolate list
30-
var fibers = [];
31-
for (var ii = 0; ii < Fiber.poolSize + 1000; ++ii) {
32-
let fiber = Fiber(function() {
33-
Fiber.yield();
17+
fibers.map(function(fiber) {
18+
fiber.run();
3419
});
35-
fiber.run();
36-
fibers.push(fiber);
3720
}
38-
fibers.map(function(fiber) {
39-
fiber.run();
40-
});
21+
return new Date - d;
22+
}
4123

42-
// Test again
43-
var ts2 = Math.min(bench(), bench());
44-
console.log(ts1 * 2 < ts2 ? 'fail' : 'pass');
45-
} else {
24+
// Run initial benchmark
25+
var ts1 = Math.min(bench(), bench());
4626

47-
// Feature is not supported
48-
console.log('pass');
27+
// Dirty up isolate list
28+
var fibers = [];
29+
for (var ii = 0; ii < Fiber.poolSize + 1000; ++ii) {
30+
let fiber = Fiber(function() {
31+
Fiber.yield();
32+
});
33+
fiber.run();
34+
fibers.push(fiber);
4935
}
36+
fibers.map(function(fiber) {
37+
fiber.run();
38+
});
39+
40+
// Test again
41+
var ts2 = Math.min(bench(), bench());
42+
console.log(ts1 * 2 < ts2 ? 'fail' : 'pass');

0 commit comments

Comments
 (0)