Skip to content

Commit 749fffa

Browse files
author
Jan Kurella
committed
fixing performance test for dual core machine
1 parent 2797ffa commit 749fffa

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test/performance.spec.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
var p2 = new Thread([1000, 2000, 3000]);
1515

1616
var start = Date.now();
17-
var start2 = Date.now();
18-
1917
var time = null;
20-
var time2 = null;
2118

2219
runs(function () {
2320
p.spawn(function (data) {
@@ -32,16 +29,25 @@
3229
time = Date.now() - start;
3330
result = data;
3431
});
32+
});
33+
34+
waitsFor(function () {
35+
return time != null;
36+
}, "Sequential should finish", 5000);
3537

38+
var start2 = Date.now();
39+
var time2 = null;
40+
41+
runs(function () {
3642
p2.map(slowSquare).then(function (data) {
3743
time2 = Date.now() - start2;
3844
result = data;
3945
});
4046
});
4147

4248
waitsFor(function () {
43-
return time != null && time2 != null;
44-
}, "it should finish", 5000);
49+
return time2 != null;
50+
}, "Parallel should finish", 5000);
4551

4652
runs(function () {
4753
expect(time2).toBeLessThan(time / cpus);

0 commit comments

Comments
 (0)