More threads -> Slower program ??
Adam D. Ruppe via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Aug 12 16:15:47 PDT 2015
On Wednesday, 12 August 2015 at 23:06:32 UTC, Yuxuan Shui wrote:
> What is wrong here?
I didn't look too closely, but there's some memory allocations
going on there which have the potential of locking all the
threads any time one of them tries to allocate.
Parallelism's benefits are largely erased by the memory allocator
lock and can be set back by the cache being invalidated as it
jumps around that allocated memory, so you generally want to make
sure the threads are doing work on local variables only.
This restricts what you can do with strings, since most the
std.string functions allocate new strings for their return
values...
More information about the Digitalmars-d-learn
mailing list