[Issue 14886] New: std.parallelism.parallel with large static array seems to hang compile
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Aug 7 11:49:24 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14886
Issue ID: 14886
Summary: std.parallelism.parallel with large static array seems
to hang compile
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Keywords: performance
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: schveiguy at yahoo.com
example:
import std.parallelism;
void main()
{
int x[100_000];
parallel(x);
}
If you remove one 0 from the number of elements, the compile finishes with an
error:
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3780(3878):
Error: template std.range.primitives.popFront cannot deduce function from
argument types !()(int[10000]), candidates are:
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2032):
std.range.primitives.popFront(T)(ref T[] a) if (!isNarrowString!(T[]) &&
!is(T[] == void[]))
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2055):
std.range.primitives.popFront(C)(ref C[] str) if (isNarrowString!(C[]))
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3780(3867):
Error: function
std.parallelism.ParallelForeach!(int[10000]).ParallelForeach.opApply.doIt.makeTemp
no return exp; or assert(0); at end of function
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3792(3890):
Error: template std.range.primitives.popFront cannot deduce function from
argument types !()(int[10000]), candidates are:
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2032):
std.range.primitives.popFront(T)(ref T[] a) if (!isNarrowString!(T[]) &&
!is(T[] == void[]))
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/range/primitives.d(2055):
std.range.primitives.popFront(C)(ref C[] str) if (isNarrowString!(C[]))
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d-mixin-3792(3879):
Error: function
std.parallelism.ParallelForeach!(int[10000]).ParallelForeach.opApply.doIt.makeTemp
no return exp; or assert(0); at end of function
/Users/steves/git/dmd2/osx/bin/../../src/phobos/std/parallelism.d(3303): Error:
template instance std.parallelism.ParallelForeach!(int[10000]) error
instantiating
testarray.d(6): instantiated from here: parallel!(int[10000])
I'm unsure if this is a bug in the compiler or a bug in std.parallelism. I
don't know how the latter is designed to work, but it does appear that there
isn't a valid instantiation for it, so I would suspect a compiler issue.
The timing seems to be non-linear based on the number of elements:
10k elements: 1.5 seconds to reach error
20k elements: 5.2 seconds to reach error
30k elements: 12.2 seconds to reach error
40k elements: 20.9 seconds to reach error
50k elements: 32.9 seconds to reach error
I stopped after that :)
--
More information about the Digitalmars-d-bugs
mailing list