6 |
|
|
7 |
|
// Performance-tuning constant: |
8 |
|
static long lastStealCount; |
9 |
< |
|
9 |
> |
|
10 |
|
public static void main(String[] args) throws Exception { |
11 |
|
int procs = 0; |
12 |
|
int num = 43; |
21 |
|
return; |
22 |
|
} |
23 |
|
|
24 |
< |
|
24 |
> |
|
25 |
|
for (int reps = 0; reps < 2; ++reps) { |
26 |
|
ForkJoinPool g = procs == 0? new ForkJoinPool() : |
27 |
|
new ForkJoinPool(procs); |
57 |
|
int number; |
58 |
|
DynamicLeftSpineFib next; |
59 |
|
|
60 |
< |
DynamicLeftSpineFib(int n, DynamicLeftSpineFib nxt) { |
61 |
< |
number = n; next = nxt; |
60 |
> |
DynamicLeftSpineFib(int n, DynamicLeftSpineFib nxt) { |
61 |
> |
number = n; next = nxt; |
62 |
|
} |
63 |
|
|
64 |
|
int getAnswer() { |
85 |
|
|
86 |
|
// Sequential version for arguments less than threshold |
87 |
|
static int seqFib(int n) { |
88 |
< |
if (n <= 1) |
88 |
> |
if (n <= 1) |
89 |
|
return n; |
90 |
< |
else |
90 |
> |
else |
91 |
|
return seqFib(n-1) + seqFib(n-2); |
92 |
|
} |
93 |
– |
|
94 |
– |
} |
93 |
|
|
94 |
+ |
} |