Re: Using tasks without GC?

2020-01-05 Thread Chris Katko via Digitalmars-d-learn
Thanks everyone, looks like i'll have to benchmark myself (which is fine) but I'm always afraid because I know "proper benchmarking is hard. (TM)" Feel free to throw any other side advice in. I'm looking to get a broad perspective on this. Straight up shutting off the garbage collector in

Re: Using tasks without GC?

2020-01-04 Thread dwdv via Digitalmars-d-learn
Creates a Task on the GC heap that calls an alias. If possible, there's also scopedTask, which allocates on the stack: https://dlang.org/phobos/std_parallelism.html#.scopedTask So my question is: Has anyone done any analysis over how "dangerous" it is to use GC'd tasks for _small_ tasks (in

Re: Using tasks without GC?

2020-01-03 Thread Elronnd via Digitalmars-d-learn
You can control when the gc runs. So if you know the allocations are small enough that they won't OOM, then you can say GC.disable, and it straight up won't run at all. But you can manually run a collection cycle (during a loading screen or whatever) with GC.collect. See

Re: Using tasks without GC?

2020-01-03 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Jan 04, 2020 at 12:51:15AM +, Chris Katko via Digitalmars-d-learn wrote: [...] > I'm looking through D's parallelism module and the docs state, > up-front: > > >Creates a Task on the GC heap that calls an alias. > > The modern, scalable way to make a parallel game engine uses

Using tasks without GC?

2020-01-03 Thread Chris Katko via Digitalmars-d-learn
When I program, it's usually videogame ideas. That implies a soft, real-time requirement. In general, that requires the mantra "allocations are evil, use object pools whenever possible." [storing data in static arrays and 'deleting' is usually just marking an entry as is_deleted=true and