On Monday, 6 October 2014 at 16:23:41 UTC, Jonathan wrote:
If I pool all unused objects such that no object needs to be
GC'ed, does it still perform scanning? What are other good ways
to avoid its overhead? As you might tell, I know rather little
how D's garbage collection works. I'm working on a game engine
and trying to be as resource efficient as possible.
FYI, I've been using Rust for the last three months and decided
to take a break from it. The documentation is far from the
quality that D has and managing explicit lifetimes becomes a
serious pain during mid project, especially in cases that you
know are already safe.
Suggestion (may or may not be useful depending on your game): use
an ECS
(http://t-machine.org/index.php/2007/09/03/entity-systems-are-the-future-of-mmog-development-part-1/)
approach with big, manually allocated arrays of structs in the
implementation. I'm working on something but it's not documented
enough/API is butt-ugly/not nearly stable-enough yet:
https://github.com/kiith-sa/tharsis-core
Some people are working on other ECS's too, see code.dlang.org
(some are very efficient, some are not... don't remember which).
And (very simplistic advice, but...) if ECS doesn't fit your
needs or you do use GC to allocate a lot of stuff anyway, reuse
dead objects and control the GC by disable()ing/reenabling and
explicitly fullCollect()ing.