Windows multi-threading performance issues on multi-core systems only

2009-12-14 Thread Dan
I have a question regarding performance issue I am seeing on multicore Windows systems. I am creating many threads to do parallel tasks, and on multicore Windows systems the performance is abysmal. If I use task manager to set the processor affinity to a single CPU, the program runs as I would

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-14 Thread dsimcha
== Quote from Dan (dsstruth...@yahoo.com)'s article > I have a question regarding performance issue I am seeing on multicore Windows systems. I am creating many threads to do parallel tasks, and on multicore Windows systems the performance is abysmal. If I use task manager to set the processor af

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread zsxxsz
== Quote from dsimcha (dsim...@yahoo.com)'s article > == Quote from Dan (dsstruth...@yahoo.com)'s article > > I have a question regarding performance issue I am seeing on multicore > > Windows > systems. I am creating many threads to do parallel tasks, and on multicore > Windows systems the perfo

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Steven Schveighoffer
On Mon, 14 Dec 2009 21:18:28 -0500, dsimcha wrote: == Quote from Dan (dsstruth...@yahoo.com)'s article I have a question regarding performance issue I am seeing on multicore Windows systems. I am creating many threads to do parallel tasks, and on multicore Windows systems the performance i

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread dsimcha
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > Maybe I'm wrong, is there a good test case to prove it is worse on > multiple cores? > -Steve This is a synthetic, extreme corner case benchmark, but I think it hammers home the point that such problems are at least plausible. T

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Michel Fortin
On 2009-12-15 10:28:37 -0500, dsimcha said: void doAppending() { uint[] arr; foreach(i; 0..1_000_000) { arr ~= i; } } For comparison's sake, you might want to compare that with malloc/realloc: void doAppending() { uint* arr = null; foreach(i; 0..1_000_000)

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Dan
dsimcha Wrote: > == Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > > Maybe I'm wrong, is there a good test case to prove it is worse on > > multiple cores? > > -Steve > > This is a synthetic, extreme corner case benchmark, but I think it hammers > home > the point that such pr

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread dsimcha
== Quote from Dan (dsstruth...@yahoo.com)'s article > My code does do considerable array appending, and I see exactly the same issue as dsimcha points out above. I would expect it is GC related, but why for multiple cores only, I cannot fathom. > Thanks for the repro, dsimcha! My code snippet wou

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Steven Schveighoffer
On Tue, 15 Dec 2009 12:23:01 -0500, dsimcha wrote: == Quote from Dan (dsstruth...@yahoo.com)'s article My code does do considerable array appending, and I see exactly the same issue as dsimcha points out above. I would expect it is GC related, but why for multiple cores only, I cannot fat

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread dsimcha
== Quote from Steven Schveighoffer (schvei...@yahoo.com)'s article > Yes, but why does multiple cores make the problem worse? If it's the > lock, then I'd expect just locking in multiple threads without any > appending does worse on multiple cores than on a single core. It does. import std.stdio

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Simen kjaeraas
dsimcha wrote: This is a synthetic, extreme corner case benchmark, but I think it hammers home the point that such problems are at least plausible. Tested on a Core 2 Quad with -O -inline -release: Timing with affinity for all 4 CPUs: 28390 milliseconds Timing with affinity for only 1 CP

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread dsimcha
== Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article > dsimcha wrote: > > This is a synthetic, extreme corner case benchmark, but I think it > > hammers home > > the point that such problems are at least plausible. Tested on a Core 2 > > Quad with > > -O -inline -release: > > Timing wi

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Sergey Gromov
dsimcha wrote: == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article dsimcha wrote: Timing with affinity for all 4 CPUs: 28390 milliseconds Timing with affinity for only 1 CPU: 533 milliseconds Tested this on a Core 2 Duo, same options. OS is Windows 7, 64bit. It scales roughly i

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Simen kjaeraas
On Wed, 16 Dec 2009 03:01:54 +0100, Sergey Gromov wrote: dsimcha wrote: == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article dsimcha wrote: Timing with affinity for all 4 CPUs: 28390 milliseconds Timing with affinity for only 1 CPU: 533 milliseconds Tested this on a Core 2

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-15 Thread Michel Fortin
On 2009-12-15 19:49:43 -0500, dsimcha said: == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article Tested this on a Core 2 Duo, same options. OS is Windows 7, 64bit. It scales roughly inverse linearly with number of threads: 163ms for 1, 364ms for 2, 886ms for 4 This is quite differen

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-16 Thread Jacob Carlborg
On 12/16/09 03:44, Michel Fortin wrote: On 2009-12-15 19:49:43 -0500, dsimcha said: == Quote from Simen kjaeraas (simen.kja...@gmail.com)'s article Tested this on a Core 2 Duo, same options. OS is Windows 7, 64bit. It scales roughly inverse linearly with number of threads: 163ms for 1, 364ms

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-16 Thread Michel Fortin
On 2009-12-16 07:08:30 -0500, Jacob Carlborg said: On 12/16/09 03:44, Michel Fortin wrote: Core 2 Duo / Mac OS X 10.6 / 4 threads: Crystal:~ mifo$ ./test Set affinity, then press enter. Bus error Runs for about 18 seconds, then crashes. At first glance, it looks as if the Thread class is br

Re: Windows multi-threading performance issues on multi-core systems only

2009-12-16 Thread Sean Kelly
Michel Fortin Wrote: > On 2009-12-16 07:08:30 -0500, Jacob Carlborg said: > > > On 12/16/09 03:44, Michel Fortin wrote: > >> Core 2 Duo / Mac OS X 10.6 / 4 threads: > >> > >> Crystal:~ mifo$ ./test > >> Set affinity, then press enter. > >> > >> Bus error > >> > >> Runs for about 18 seconds, t