digitalmars.D.learn - How disruptive is the GC?
- Snape (7/7) Jul 29 2015 I'm in the early stages of building a little game with OpenGL (in
- Rikki Cattermole (11/18) Jul 29 2015 Some tips:
- Namespace (2/10) Jul 29 2015 http://3d.benjamin-thaut.de/?p=20
- Kapps (9/19) Jul 29 2015 Note that this was 3 years ago, so there have been GC
- ponce (5/13) Aug 01 2015 The GC is noticeable and you will probably have to minimize the
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (10/18) Aug 02 2015 I'd like to add that you can tell the runtime (and therefore the
- Temtaime (8/8) Aug 02 2015 I'm writing a game engine in D. Try to minimize allocations and
I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?
Jul 29 2015
On 29/07/2015 9:25 p.m., Snape wrote:I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?Some tips: - Avoid allocations if possible - Use buffers/preallocated memory if possible - Disable the GC (collection only) - Use allocators instead of e.g. new - -vgc is awesome If you are using GC to allocate (not really a good idea), run collect when you have some spare cycles. Can't really say much about the current GC implementation. But what I do know is for real time apps GC is not a good tool for memory management.
Jul 29 2015
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?http://3d.benjamin-thaut.de/?p=20
Jul 29 2015
On Wednesday, 29 July 2015 at 17:09:52 UTC, Namespace wrote:On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:Note that this was 3 years ago, so there have been GC improvements since then. I'm not sure what the results would be like today (or what the code is like in terms of needless allocations). That being said, you probably want to avoid the GC as much as possible for games. Luckily we have tools like -vgc to help with that now (and nogc, but I still consider this mostly unusable thanks largely to exceptions).I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?http://3d.benjamin-thaut.de/?p=20
Jul 29 2015
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?The GC is noticeable and you will probably have to minimize the heap size. Fortunately the use of -vgc and nogc helps a lot to mitigate the pauses.
Aug 01 2015
On Wednesday, 29 July 2015 at 09:25:50 UTC, Snape wrote:I'm in the early stages of building a little game with OpenGL (in D) and I just want to know the facts about the GC before I decide to either use it or work around it. Lots of people have said lots of things about it, but some of that information is old, so as of today, what effect does the GC have on the smooth operation of a real-time application? Is it pretty noticeable with any use of the GC or only if you're deallocating large chunks at a time?I'd like to add that you can tell the runtime (and therefore the GC) to ignore a thread: This allows you to implement real-time tasks in that thread, and it will never be interrupted by the GC. You can still use the GC in other threads. Of course, you need to make sure not to call into the GC from the detached thread (easy by using nogc), and to keep at least one reference to GC data used in the detached thread in a normal thread.
Aug 02 2015
I'm writing a game engine in D. Try to minimize allocations and that's will be OK. I'm using delegates and all the phobos stuff. I allocate only in few places at every frame. So i can reach 1K fps on a complicated scene. GC is not a problem. DMD optimizes so ugly that all the math is very, very slow. DMD gives me about 200 fps, when with LDC i can reach 1k.
Aug 02 2015