Re: Create many objects using threads

2014-05-06 Thread Ali Çehreli via Digitalmars-d-learn
On 05/06/2014 05:46 AM, hardcoremore wrote: > But what does exactly means that Garbage Collector blocks? What > does it blocks and in which way? I know this much: The current GC that comes in D runtime is a single-threaded GC (aka "a stop-the-world GC"), meaning that all threads are stopped wh

Re: Create many objects using threads

2014-05-06 Thread Kapps via Digitalmars-d-learn
On Tuesday, 6 May 2014 at 15:56:11 UTC, Kapps wrote: On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote: On 05/05/2014 02:38 PM, Kapps wrote: > I think that the GC actually blocks when > creating objects, and thus multiple threads creating instances would not > provide a significant speed

Re: Create many objects using threads

2014-05-06 Thread Kapps via Digitalmars-d-learn
On Monday, 5 May 2014 at 22:11:39 UTC, Ali Çehreli wrote: On 05/05/2014 02:38 PM, Kapps wrote: > I think that the GC actually blocks when > creating objects, and thus multiple threads creating instances would not > provide a significant speedup, possibly even a slowdown. Wow! That is the case.

Re: Create many objects using threads

2014-05-06 Thread hardcoremore via Digitalmars-d-learn
On Tuesday, 6 May 2014 at 03:26:52 UTC, Ali Çehreli wrote: On 05/05/2014 04:32 PM, Caslav Sabani wrote: > So basically using threads in D for creating multiple instances of class is > actually slower. Not at all! That statement can be true only in certain programs. :) Ali But what does ex

Re: Create many objects using threads

2014-05-05 Thread Ali Çehreli via Digitalmars-d-learn
On 05/05/2014 04:32 PM, Caslav Sabani wrote: > So basically using threads in D for creating multiple instances of class is > actually slower. Not at all! That statement can be true only in certain programs. :) Ali

Re: Create many objects using threads

2014-05-05 Thread Caslav Sabani via Digitalmars-d-learn
Hi all, Thanks for your reply. So basically using threads in D for creating multiple instances of class is actually slower. But what does exactly means that Garbage Collector blocks? What does it blocks and in which way? Thanks

Re: Create many objects using threads

2014-05-05 Thread Ali Çehreli via Digitalmars-d-learn
On 05/05/2014 02:38 PM, Kapps wrote: > I think that the GC actually blocks when > creating objects, and thus multiple threads creating instances would not > provide a significant speedup, possibly even a slowdown. Wow! That is the case. :) > You'd want to benchmark this to be certain it helps.

Re: Create many objects using threads

2014-05-05 Thread Kapps via Digitalmars-d-learn
On Monday, 5 May 2014 at 17:14:54 UTC, Caslav Sabani wrote: Hi, I have just started to learn D. Its a great language. I am trying to achieve the following but I am not sure is it possible or should be done at all: I want to have one array where I will store like 10 objects. But I wa

Re: Create many objects using threads

2014-05-05 Thread Ali Çehreli via Digitalmars-d-learn
On 05/05/2014 01:38 PM, Caslav Sabani wrote: > I am struggling to understand from your example where is the code that > creates or spawns new thread. The .parallel in the foreach loop makes the body of the loop be executed in parallel. > How do you create new thread and fill array with instan

Re: Create many objects using threads

2014-05-05 Thread Caslav Sabani via Digitalmars-d-learn
Hi Ali, Thanks for your reply. But I am struggling to understand from your example where is the code that creates or spawns new thread. How do you create new thread and fill array with instantiated objects in that thread? Thanks

Re: Create many objects using threads

2014-05-05 Thread Ali Çehreli via Digitalmars-d-learn
On 05/05/2014 10:25 AM, Ali Çehreli wrote: > On 05/05/2014 10:14 AM, Caslav Sabani wrote: > > > I want to have one array where I will store like 10 objects. > > > > But I want to use 4 threads where each thread will create 25000 objects > > and store them in array above mentioned. > >