digitalmars.D.bugs - [Issue 12708] New: DMD threaded code running slower than
- via Digitalmars-d-bugs (63/63) May 05 2014 https://issues.dlang.org/show_bug.cgi?id=12708
https://issues.dlang.org/show_bug.cgi?id=12708 Issue ID: 12708 Summary: DMD threaded code running slower than single-threaded code Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: regression Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: atila.neves gmail.com The program below runs slower with threads (no "-s" option) than in one thread (with the "-s" option). The opposite happens when compiling with gdc, which is the expected behaviour. Found with dmd 2.065 on Arch Linux 64-bit. import std.parallelism; import std.getopt; import std.array; import std.ascii; import std.base64; import std.bigint; import std.bitmanip; import std.concurrency; import std.container; import std.cstream; alias TestFunction = void function(); auto getTests(Modules...)() { TestFunction[] tests; foreach(mod; Modules) { foreach(test; __traits(getUnitTests, mod)) { tests ~= &test; } } return tests; } void main(string[] args) { bool single; getopt(args, "single|s", &single ); enum tests = getTests!( std.array, std.ascii, std.base64, std.bigint, std.bitmanip, std.concurrency, std.container, std.cstream, ); if(single) { foreach(test; tests) { test(); } } else { foreach(test; tests.parallel) { test(); } } } --
May 05 2014