July 16, 2013 Re: [OT] Why mobile web apps are slow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan A Dunlap | On Tuesday, 16 July 2013 at 18:21:05 UTC, Jonathan A Dunlap wrote:
>> You can also make use of library types for reference counting,
>>
>> http://dlang.org/phobos/std_typecons.html#.RefCounted
>>
>> And if you really, really need, also manual memory management by calling the C functions and letting the GC know not to track that memory.
>>
>> http://dlang.org/phobos/core_memory.html#.GC.BlkAttr.NO_SCAN
>
> Fascinating! I assume the Phobos RefCounted then avoids using the GC by utilizing GC.malloc (NO_SCAN) behind the scenes?
Nope, just plain old malloc and free from core.stdc.stdlib
|
July 17, 2013 Re: [OT] Why mobile web apps are slow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan Dunlap | On Tuesday, 16 July 2013 at 14:53:05 UTC, Jonathan Dunlap wrote: >>> So before Java was born, I was already convinced a GC was > possible for systems programming. > > Can you explain (simply) how D's GC works and what improvements are on the roadmap for it? As it sits, I'm a little hesitant to use it for large applications because of its overhead I've heard about on other threads. > Good news, you can actually free bunch of memory yourself in D if you need to via GC.free to reduce the GC pressure. > http://3d.benjamin-thaut.de/?p=20 > "the manual memory managed version runs at 5 ms which is 200 FPS and thus nearly 3 times as fast as the GC collected version." This highlight the poor GC performances, but also the fact that way too much allocation are done when not required, which increase the GC pressure. This is something considered seriously and the amount is decreasing with each version of D. |
July 17, 2013 Re: [OT] Why mobile web apps are slow | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan A Dunlap | On Tuesday, 16 July 2013 at 18:21:05 UTC, Jonathan A Dunlap wrote:
>> You can also make use of library types for reference counting,
>>
>> http://dlang.org/phobos/std_typecons.html#.RefCounted
>>
>> And if you really, really need, also manual memory management by calling the C functions and letting the GC know not to track that memory.
>>
>> http://dlang.org/phobos/core_memory.html#.GC.BlkAttr.NO_SCAN
>
> Fascinating! I assume the Phobos RefCounted then avoids using the GC by utilizing GC.malloc (NO_SCAN) behind the scenes? Has anyone benchmarked an application using D's GC versus using RefCounted for critical paths?
I highly advice not to use the NO_SCAN unless you really know what you are doing. Not that the GC will trigger only when enough memory is allocated, so if you deallocate most memory manually, the GC won't trigger often.
|
Copyright © 1999-2021 by the D Language Foundation