On Thursday, 17 April 2014 at 12:20:06 UTC, Manu via Digitalmars-d wrote:
See, I just don't find managed memory incompatible with 'low level' realtime or embedded code, even on tiny microcontrollers in principle.

RC isn't incompatible with realtime, since the overhead is O(1).

But it is slower than the alternatives where you want maximum performance. E.g. raytracing.

And it is slower and less more "safe" than GC for long running servers that have uneven loads. E.g. web services.

I think it would be useful to discuss real scenarios when discussing performance:

1. Web server request that can be handled instantly (no database lookup): small memory requirements and everything is released immediately.

Best strategy might be to use a release pool (allocate incrementally and free all upon return in one go).

2. Web server, cached content-objects: lots of cycles, shared across threads.

Best strategy is global GC.

3. Non-maskable interrupt: can cut into any running code at any time. No deallocation must happen and can only touch code that is consistent after atomic single instruction CPU operations.

Best strategy is preallocation and single instruction atomic communication.

ARC would be fine in low level code, assuming the language supported it to
the fullest of it's abilities.

Yes, but that requires whole program optimization, since function calls cross compilation unit boundaries frequently.

No. It misses basically everything that compels the change. Strings, '~',
closures. D largely depends on it's memory management.

And that is the problem. Strings can usually be owned objects.

What benefits most from GC are the big complex objects that have lots of links to other objects, so you get many circular references.

You usually have fewer of those.

If you somehow can limit GC to precise collection of those big objects, and forbid foreign references to those, then the collection cycle could complete quickly and you could use GC for soft real time. Which most code application code is.

I don't know how to do it, but global-GC-everything only works for batch programming or servers with downtime.

Take this seriously. I want to see ARC absolutely killed dead rather than dismissed.

Why is that? I can see ARC in D3 with whole program optimization. I cannot see how D2 could be extended with ARC given all the other challenges.

Ola.

Reply via email to