|
1 load(libdir + "parallelarray-helpers.js"); |
|
2 |
|
3 function testMap() { |
|
4 |
|
5 // Note: This is the same kernel function as `alloc-many-objs`, but |
|
6 // with a larger bound. This often fails par. exec. because it |
|
7 // triggers GC at inconvenient times. But let's just test that it |
|
8 // doesn't crash or something! |
|
9 |
|
10 var ints = range(0, 100000); |
|
11 |
|
12 // The disqual occurs because each time we try to run we wind up |
|
13 // bailing due to running out of memory or requesting a GC. |
|
14 assertParallelExecWillBail(function (m) { |
|
15 ints.mapPar(kernel, m); |
|
16 }); |
|
17 |
|
18 function kernel(v) { |
|
19 var x = []; |
|
20 |
|
21 if (inParallelSection()) { |
|
22 // don't bother to stress test the non-parallel paths! |
|
23 for (var i = 0; i < 50; i++) { |
|
24 x[i] = []; |
|
25 for (var j = 0; j < 1024; j++) { |
|
26 x[i][j] = j; |
|
27 } |
|
28 } |
|
29 } |
|
30 |
|
31 return x; |
|
32 } |
|
33 } |
|
34 |
|
35 if (getBuildConfiguration().parallelJS) |
|
36 testMap(); |
|
37 |