Nobady is going to complain about that...
solidstate1991
laszloszeremi at outlook.com
Thu Apr 23 19:48:33 UTC 2020
On Wednesday, 22 April 2020 at 18:21:13 UTC, Paulo Pinto wrote:
>
> Meanwhile in real world:
>
> https://docs.unrealengine.com/en-US/Programming/UnrealArchitecture/Objects/Optimizations/index.html
>
> https://unity3d.com/partners/microsoft/mixed-reality
>
> https://stadia.dev/intl/de_de/blog/unity-production-ready-support-for-stadia-now-available/
>
> https://developer.nintendo.com/tools
>
> https://developers.google.com/ar/develop/unity
>
> https://www.cryengine.com/tutorials/view/programming-and-project-guides/c-programming#
>
> https://gvisor.dev/
>
> https://gapid.dev/about/
>
> So yeah, those guys on the videos are entitled to their
> opionion on how GCs are bad, yet Google, Nintendo, Microsoft,
> Epic, Crytech seem to be doing quite fine with them.
And I have experimented with GC in D for time critical
applications like games. Here are my current recommendations:
* Label everything with `@nogc` that doesn't allocate on the
heap. Unlabelled stuff sometimes can make the runtime to check
those parts whether you've allocated with them or not.
* Use structs whenever you can.
* GC allocation with `new` has little to no performance penalty
compared to using `malloc` or something like that, only the
former is less of a hassle and have less of a chance for
something to go wrong.
* Other forms of optimizations (Data-Oriented Design, etc.) are
more important that fearing the GC and writing unsafe code using
`malloc` and `free`.
* Currently I'm using external an API (SDL2_Sound) for audio, my
workaround I've came up for CPU rendering might not work there
once I'll start working on some advanced audio features.
A missing and very useful feature from D would be emulating
`alloca`, or stack allocating. There's already something like
that with @nogc exceptions, an equivalent for other classes would
be useful from time to time.
More information about the Digitalmars-d
mailing list