digitalmars.D - Garbage Collection and gamedev - tl;dr Yes we want it, so let's solve
- Ethan (76/76) Nov 22 2020 There's many nuanced points to consider here, so given that GC
- Ola Fosheim Grostad (7/12) Nov 22 2020 You cannot have incremental collection as that requires barriers
- rikki cattermole (5/7) Nov 22 2020 Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.
- Ola Fosheim Grostad (11/19) Nov 23 2020 Fork is expensive in the sense that when the game modifies memory
- Ola Fosheim Grostad (5/8) Nov 23 2020 I guess this is not an issue with POSIX fork in this context as
- Ola Fosheim Grostad (4/12) Nov 23 2020 For instance, if the app marks memory as dontfork with madvise
- aberba (3/10) Nov 23 2020 Can you expand on this?
- rikki cattermole (14/28) Nov 23 2020 There isn't much to say.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (9/11) Nov 23 2020 Rikki, I want to add that I don't argue that it shouldn't be the
- rikki cattermole (3/16) Nov 23 2020 Its not actually my idea. Rainer has already done an implementation :)
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (6/9) Nov 23 2020 Alright! So now we need a high quality portable GUI framework
- rikki cattermole (6/8) Nov 23 2020 I'm working on it.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (8/17) Nov 23 2020 Haha! Yea, I've spent a lot of time reading about this topic.
- Jacob Carlborg (5/6) Nov 23 2020 FYI, `fork` is not available on iOS, tvOS and watchOS.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (2/6) Nov 23 2020 On iOS you probably should use ARC. LLVM IR has ObjC ARC support.
- Guillaume Piolat (4/10) Nov 23 2020 Actually on macOS latest I had problems with program that ask for
- Ethan (4/10) Nov 23 2020 And I've said this every time the word "fork" is mentioned: We
- Ethan (30/32) Nov 22 2020 So chatting with Atila on beerconf. The conversation that comes
- Ola Fosheim Grostad (13/18) Nov 22 2020 If you want to mix ARC and GC in the same executable, for high
- Ola Fosheim Grostad (9/11) Nov 22 2020 That was a bit terse. What I meant is that you could use the same
- Paulo Pinto (7/25) Nov 23 2020 Other bad news is that if you don't want the runtime to look bad
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (18/23) Nov 23 2020 Not exactly sure what you mean by this. Swift isn't really
- Paulo Pinto (12/39) Nov 23 2020 It is always about theory, in practice tracing GC always wins.
- Ola Fosheim =?UTF-8?B?R3LDuHN0YWQ=?= (16/17) Nov 23 2020 That really depends, but a tracing GC is easier to use, as it
- random (14/27) Nov 22 2020 A benefit of the library solution is that the user can always
- Ethan (8/11) Nov 22 2020 The runtime is 100% overridable by the user. Walter continually
- Paulo Pinto (10/20) Nov 22 2020 Actually no, you cannot not, at least not with pure ISO C.
- RazvanN (12/27) Nov 22 2020 I've been looking into this and the main issue that has caused
- Adam D. Ruppe (6/10) Nov 22 2020 @trusted I understand, but the others should be correctly
- RazvanN (18/28) Nov 22 2020 What about purity? If your code is pure but the runtime hook is
- Adam D. Ruppe (7/10) Nov 22 2020 Do you have a specific example in there now? Your little given
- RazvanN (7/17) Nov 22 2020 Hmmm, I struggled with this in
- ryuukk_ (12/12) Nov 24 2020 This is a step in the right direction, but as usual, when will we
- Paulo Pinto (7/19) Nov 24 2020 ARC/RC also stops the world, hence the typical optimization to
- Araq (5/12) Nov 24 2020 Except that it's an algorithm oblivious to the involved heap
- Ola Fosheim Grostad (4/8) Nov 24 2020 ARC does not stop the world.
- Araq (7/8) Nov 24 2020 He means the "unbounded" destruction phase when an enormous data
- ryuukk_ (2/2) Nov 24 2020 Unity moving to incremental GC
- Ola Fosheim Grostad (12/13) Nov 25 2020 But they have the money for it. What would you charge for
- Guillaume Piolat (18/20) Nov 25 2020 I love the irony there.
- Ola Fosheim Grostad (5/9) Nov 25 2020 I dont know. In my experience dropped frames are annoying in
- Ola Fosheim Grostad (11/14) Nov 25 2020 btw, Ive had a lot if headaches over missed frames when doing
- aberba (5/19) Nov 25 2020 🤷♂️ Can't change your opinion about JavaScript. I know 100s of...
- Ola Fosheim Grostad (8/11) Nov 25 2020 I am not discussing JavaScript, the Chrome team has put a massive
- aberba (3/13) Nov 25 2020 +1. Couldn't have said it any better.
- Ola Fosheim Grostad (4/12) Nov 25 2020 It could happen in a game where you can teleport, but ARC can be
- Paulo Pinto (3/16) Nov 25 2020 Which is also possible alongside tracing GC implementations.
- Ola Fosheim Grostad (2/3) Nov 25 2020 If it allows for separate pools.
- Paulo Pinto (4/8) Nov 25 2020 Indeed, and I have used them in Go, Java and .NET, so D can
- Ola Fosheim Grostad (3/8) Nov 25 2020 Didn't know Go had that in, cool. :)
- Paulo Pinto (5/15) Nov 25 2020 What is so special about having memory allocated over OS APIs and
- Ola Fosheim Grostad (3/20) Nov 25 2020 It isnt sufficient to have arenas you need to prove that there
- Elronnd (13/16) Nov 25 2020 That's not true. The problem with reference counting is that the
- Araq (7/23) Nov 25 2020 That's about implicit vs explicit code, still not about the
- ryuukk_ (1/1) Nov 26 2020 https://technology.riotgames.com/news/leveraging-golang-game-development...
- ryuukk_ (7/8) Nov 26 2020 Oops forgot to add my text
- ryuukk_ (3/11) Nov 26 2020 Why no EDIT feature on the forum? i shouldn't type after drinking
- rikki cattermole (2/4) Nov 26 2020 This is not a forum. It is a mailing list with a fancy web interface.
- Mike Parker (4/9) Nov 27 2020 It's a newsgroup with a mailing list interface and a fancy web
- Paulo Pinto (23/31) Nov 26 2020 It doesn't need to be opensource as such, the point is "as long
- Ola Fosheim Grostad (4/12) Nov 26 2020 That web page was for servers... No, we cannot copy their GC.
- Paulo Pinto (5/19) Nov 27 2020 Better be usable at game servers or game related pipeline
- Ola Fosheim Grostad (3/7) Nov 27 2020 Why would one of the current GCs be a problem on a server?
- Paulo Pinto (13/20) Nov 27 2020 It wouldn't, hence why I think it is better outcome focusing on
- Ola Fosheim Grostad (3/4) Nov 27 2020 Maybe something for people interested in existing frameworks. I
- Guillaume Piolat (15/20) Nov 27 2020 +1
- Ola Fosheim Grostad (6/9) Nov 27 2020 Yes, but that is not a language feature.
- Guillaume Piolat (18/32) Nov 27 2020 I'm not discounting that D is a nice language (if people say they
- Ola Fosheim Grostad (23/31) Nov 27 2020 Yes, or the service it runs on. Which is why I think D ought to
- Guillaume Piolat (14/19) Nov 27 2020 "framework" word really is the point of conflict.
- Ola Fosheim Grostad (20/28) Nov 27 2020 Focused frameworks are good if they are written to coexist with
- Paulo Pinto (7/29) Dec 01 2020 So here are plenty of examples using Go in WASM with a 2D games
- Ben Jones (5/10) Dec 09 2020 Here's an interesting paper from MSR about doing precise ARC.
- Ola Fosheim Grostad (3/13) Dec 09 2020 Thanks fo sharing, I will certainly read this later when I have
- Paulo Pinto (2/12) Dec 09 2020 Thanks, quite interesting read.
- Ola Fosheim Grostad (9/11) Nov 27 2020 But only if the thread has low memory footprint. The downside of
- jmh530 (3/17) Nov 22 2020 Maybe organize a group to meet once a week to discuss issues and
There's many nuanced points to consider here, so given that GC came up on the live Q&A and I got in to a bit of a chat there I figured copy/pasting that log and getting in to a (real, stop-saying-gamedev-doesn't-want-this) longer form discussion about the exact kind of GC we want in game development. There's a few people in the community here that are involved in console game dev, and they would know the kind of characteristics we require. Similarly, many of the lower level programmers that work with GPUs and the like are well aware that garbage collection is not good enough for releasing resources outside of the main system environment and would know the kind of control we require over deallocation and release paths. The short form of my view is that we are actively using GC in game dev at all levels. The largest commercial AAA engine has been garbage collecting since the 90s (and go deeper, the original Doom garbage collected). But as we scale up to massively parallel execution across all forms of programming, the monolithic program-halting mark and sweep GC that comes with D is not good enough. I've not yet sat down to do the full research in to the subject that it demands, but I have ideas on what I want to look at. Conversation copied to below: TheRealGooberMan I want to write a task-based GC, that will handle destruction/deallocation as a task when the last reference to a section of memory is unacquired FeepingCreature is freeing memory that costly in D? TheRealGooberMan The advantage of a collector is that it's a batch process TheRealGooberMan And computers LOVE batch processes TheRealGooberMan But in gamedev, we need a bit more immediate control at times FeepingCreature no I mean, it just feels like you're optimizing the fastest part of the process FeepingCreature ya'll are really sensitive to question marks ending a line 🙂 TheRealGooberMan The collector blocks the program currently. That's bad for gamedev TheRealGooberMan And yes, we do have Unreal Engine as the most direct example that does exactly this TheRealGooberMan Anyone saying "gamedev doesn't GC" isn't paying attention TheRealGooberMan We just want a better solution FeepingCreature the collector blocks the program, but it blocks for scanning, and task-based doesn't speed that up, right? TheRealGooberMan No, it's not about speeding it up at that point. It's about not blocking anything else from running FeepingCreature right but mark phase has to block inherently, unless you get really clever with your design or get hardware support TheRealGooberMan This is an extra advantage of the pointer acquire/unacquire runtime hooks that I want. It's a bit more code, but it also negates the need to do any kind of sweep TheRealGooberMan And it is something that should be opt-in, yeah. If your GC doesn't define the hooks, then the code gen shouldn't try to insert them TheRealGooberMan Pay as you go functionality! FeepingCreature I don't know the background of that, but yeah, I don't know how the relative cost of mark and sweep is, if sweep is using a lot of the fraction than speed it up by all means Lawrence Aberba I love GC 🐱🏍 FeepingCreature 😆
Nov 22 2020
On Sunday, 22 November 2020 at 14:30:45 UTC, Ethan wrote:There's many nuanced points to consider here, so given that GC came up on the live Q&A and I got in to a bit of a chat there I figured copy/pasting that log and getting in to a (real, stop-saying-gamedev-doesn't-want-this) longer form discussion about the exact kind of GC we want in game development.You cannot have incremental collection as that requires barriers and there is no way in D to tell whether you should or should not emit costly barriers statically during code gen. D would need to add an actor concept to get there. So that means there are only three options left: single threaded GC pool, non-language GC or ARC.
Nov 22 2020
On 23/11/2020 4:48 AM, Ola Fosheim Grostad wrote:So that means there are only three options left: single threaded GC pool, non-language GC or ARC.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork. We are only missing Windows support for a partially concurrent GC atm. This is the direction I believe our default should be. It covers pretty much all use cases with reasonable performance.
Nov 22 2020
On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:On 23/11/2020 4:48 AM, Ola Fosheim Grostad wrote:Fork is expensive in the sense that when the game modifies memory the process has to halt while the OS creates a copy of that memory page. You have to be very careful when writing applications that call fork, you don't want two processes appending to the same file etc. It a very special cased soltuion that basically won't work with existing c++ codebases without vetting... More suitable for a high level language where the compiler can set up the application for fork.So that means there are only three options left: single threaded GC pool, non-language GC or ARC.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork. We are only missing Windows support for a partially concurrent GC atm. This is the direction I believe our default should be. It covers pretty much all use cases with reasonable performance.
Nov 23 2020
On Monday, 23 November 2020 at 08:17:30 UTC, Ola Fosheim Grostad wrote:You have to be very careful when writing applications that call fork, you don't want two processes appending to the same file etc.I guess this is not an issue with POSIX fork in this context as it only keeps the thread that called fork. But there can be issues related to resources.
Nov 23 2020
On Monday, 23 November 2020 at 08:58:43 UTC, Ola Fosheim Grostad wrote:On Monday, 23 November 2020 at 08:17:30 UTC, Ola Fosheim Grostad wrote:For instance, if the app marks memory as dontfork with madvise and the gc traces a pointer into that memory.You have to be very careful when writing applications that call fork, you don't want two processes appending to the same file etc.I guess this is not an issue with POSIX fork in this context as it only keeps the thread that called fork. But there can be issues related to resources.
Nov 23 2020
On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:On 23/11/2020 4:48 AM, Ola Fosheim Grostad wrote:So that means there are only three options left: single threaded GC pool, non-language GC or ARC.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.... This is the direction I believe our default should be. It covers pretty much all use cases with reasonable performance.Can you expand on this?
Nov 23 2020
On 24/11/2020 12:50 AM, aberba wrote:On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:There isn't much to say. We already have POSIX support done, just need to implement Windows now. The basic gist of it is, you want to move the scanning + collecting to a separate concurrently executed thread. In a fork based model, that uses another process to do it. On Windows you would use another thread with a (non-changing) view of the memory of the process. The reason I say it should be the default is: with multi-core systems being the default now, adding a dedicated thread for scanning + collecting isn't all that expensive and it allows to keep the main logic of the program running without any interruptions to the end user unless an OOM situation occurs. But as Ola has said, there are down sides to this approach once you start needing performance.On 23/11/2020 4:48 AM, Ola Fosheim Grostad wrote:So that means there are only three options left: single threaded GC pool, non-language GC or ARC.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.... This is the direction I believe our default should be. It covers pretty much all use cases with reasonable performance.Can you expand on this?
Nov 23 2020
On Monday, 23 November 2020 at 12:05:14 UTC, rikki cattermole wrote:But as Ola has said, there are down sides to this approach once you start needing performance.Rikki, I want to add that I don't argue that it shouldn't be the default. I was arguing in the context of games and other demanding low latency, high memory, computation applications. Your fork-collector could be excellent for most GUI applications that are mostly based on D code. For instance, a GUI application can detect that the user is inactive and trigger a fork. It could also work for turn-based games.
Nov 23 2020
On 24/11/2020 1:58 AM, Ola Fosheim Grøstad wrote:On Monday, 23 November 2020 at 12:05:14 UTC, rikki cattermole wrote:Its not actually my idea. Rainer has already done an implementation :) http://rainers.github.io/visuald/druntime/concurrentgc.htmlBut as Ola has said, there are down sides to this approach once you start needing performance.Rikki, I want to add that I don't argue that it shouldn't be the default. I was arguing in the context of games and other demanding low latency, high memory, computation applications. Your fork-collector could be excellent for most GUI applications that are mostly based on D code. For instance, a GUI application can detect that the user is inactive and trigger a fork. It could also work for turn-based games.
Nov 23 2020
On Monday, 23 November 2020 at 13:09:31 UTC, rikki cattermole wrote:Its not actually my idea. Rainer has already done an implementation :) http://rainers.github.io/visuald/druntime/concurrentgc.htmlAlright! So now we need a high quality portable GUI framework that also can be used for turn based games. There is a push for simple games in Flutter. Maybe possible to "steal" their codebase.
Nov 23 2020
On 24/11/2020 2:31 AM, Ola Fosheim Grøstad wrote:Alright! So now we need a high quality portable GUI framework that also can be used for turn based games.I'm working on it. Problem is I'm starting all the way back at colorimetry. A fascinating deep subject that pretty much every organization in the industry has their own thing on (as I say, you implement a dozen color spaces and now you need to implement two dozen more).
Nov 23 2020
On Monday, 23 November 2020 at 13:53:04 UTC, rikki cattermole wrote:On 24/11/2020 2:31 AM, Ola Fosheim Grøstad wrote:Haha! Yea, I've spent a lot of time reading about this topic. Very interesting. And it is fun how many image rescaling applications get gamma wrong! :-D Of course, anyone who has written their own toy raytracer understands gamma (as you use linear intensity during computations). I think you can start by assuming sRGB as the default, though.Alright! So now we need a high quality portable GUI framework that also can be used for turn based games.I'm working on it. Problem is I'm starting all the way back at colorimetry. A fascinating deep subject that pretty much every organization in the industry has their own thing on (as I say, you implement a dozen color spaces and now you need to implement two dozen more).
Nov 23 2020
On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.FYI, `fork` is not available on iOS, tvOS and watchOS. -- /Jacob Carlborg
Nov 23 2020
On Monday, 23 November 2020 at 13:29:58 UTC, Jacob Carlborg wrote:On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:On iOS you probably should use ARC. LLVM IR has ObjC ARC support.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.FYI, `fork` is not available on iOS, tvOS and watchOS.
Nov 23 2020
On Monday, 23 November 2020 at 13:29:58 UTC, Jacob Carlborg wrote:On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:Actually on macOS latest I had problems with program that ask for the current directory with `absolute`. I guess the cwd could be used for a side-channel attack somehow.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.FYI, `fork` is not available on iOS, tvOS and watchOS. -- /Jacob Carlborg
Nov 23 2020
On Monday, 23 November 2020 at 13:29:58 UTC, Jacob Carlborg wrote:On Monday, 23 November 2020 at 03:15:59 UTC, rikki cattermole wrote:And I've said this every time the word "fork" is mentioned: We cannot use forking methods on consoles. This will not realistically change in your lifetime.Concurrent GC (aka fork) and concurrent DS GC with i.e. fork.FYI, `fork` is not available on iOS, tvOS and watchOS. -- /Jacob Carlborg
Nov 23 2020
On Sunday, 22 November 2020 at 14:30:45 UTC, Ethan wrote:...longer form discussion about the exact kind of GC we want in game development...So chatting with Atila on beerconf. The conversation that comes up, apart from this needing to be a DIP, is that I need to fill out some of the ideas that I have here. One of the things I mentioned is that I don't get why library solutions are pursued for handling memory allocations/garbage collecting when the runtime already exists and can be used for the same purpose. This led to highlighting that the runtime should be more templatised anyway so that it can get that deeper knowledge of objects via DbI. The runtime as designed and implemented is about ten years behind how the language progressed, so there's definitely some work that needs to happen there. But the single reason I'm focused on runtime versus a library solution. If you get the pointer acquire/release hooks in to the runtime that I talk about, then the whole argument between ARC GC and other forms comes down to a single question: "Who cares?" A library solution actively requires the user to specify the kind of memory management they want. This is not what most modern programmers need to care about. A runtime solution means that if you want to switch between ARC GC and a traditional mark/sweep GC then you just swap the runtime implementation out. The user's code does not change, and it should not need to. But yeah, this all comes down to the fact that the runtime really needs work these days. And to a degree, I imagine user-provided templates that dictate how code should be generated is an interesting compiler design paradigm that can help there. So tl;dr - DIP, but I can't think about writing one for a few months because time, but there's bound to be interesting discussion that can come up as a result of this.
Nov 22 2020
On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:But yeah, this all comes down to the fact that the runtime really needs work these days. And to a degree, I imagine user-provided templates that dictate how code should be generated is an interesting compiler design paradigm that can help there.If you want to mix ARC and GC in the same executable, for high efficiency, you need at least two types of pointers: owning and nonowning, and to break cycles you also need weak pointers (turns to null on destruction) which are useful for speculative caching as well. The good news is that going from ARC to GC is free and that ARC annotated pointers will collect faster with a precise tracing GC than is the case today. So clearly a win for libraries, either way. The bad news is that doing ARC in the LLVM IR is nontrivial so you may need a new intermediary typed language specific IR. But you need that to do live well anyway... So, why not?
Nov 22 2020
On Sunday, 22 November 2020 at 20:20:50 UTC, Ola Fosheim Grostad wrote:If you want to mix ARC and GC in the same executable, for high efficiency, you need at least two types of pointers: owning andThat was a bit terse. What I meant is that you could use the same library for both ARC and GC if you have a distinction between nonowning and owning pointers, and that this would be needed for efficient ARC/precise GC. If you also attatch a magic hidden template parameter to functions then you can have one thread using ARC and another one using a thread local GC using the same templated libraries.
Nov 22 2020
On Sunday, 22 November 2020 at 20:20:50 UTC, Ola Fosheim Grostad wrote:On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:Other bad news is that if you don't want the runtime to look bad against tracing GC implementations, https://github.com/ixy-languages/ixy-languages You need to ship your own CPU with ARC specific improvments, https://blog.metaobject.com/2020/11/m1-memory-and-performance.htmlBut yeah, this all comes down to the fact that the runtime really needs work these days. And to a degree, I imagine user-provided templates that dictate how code should be generated is an interesting compiler design paradigm that can help there.If you want to mix ARC and GC in the same executable, for high efficiency, you need at least two types of pointers: owning and nonowning, and to break cycles you also need weak pointers (turns to null on destruction) which are useful for speculative caching as well. The good news is that going from ARC to GC is free and that ARC annotated pointers will collect faster with a precise tracing GC than is the case today. So clearly a win for libraries, either way. The bad news is that doing ARC in the LLVM IR is nontrivial so you may need a new intermediary typed language specific IR. But you need that to do live well anyway... So, why not?
Nov 23 2020
On Monday, 23 November 2020 at 11:54:24 UTC, Paulo Pinto wrote:Other bad news is that if you don't want the runtime to look bad against tracing GC implementations, https://github.com/ixy-languages/ixy-languages You need to ship your own CPU with ARC specific improvments, https://blog.metaobject.com/2020/11/m1-memory-and-performance.htmlNot exactly sure what you mean by this. Swift isn't really representative of what you can achieve with ARC. Swift is designed to be easy to use and compatible with Obj-C semantics. ARC can also improve over time as more theory about shape analysis of heap patterns becomes available and you can gradually improve pointer analysis passes over time. The key issue is to not provide the programmer with manual acquire/release or any way to access the ref count. Also, in D owning!T would be nonatomic, and owning!shared(T) would be atomic unless the compiler can prove that it isn't shared yet. My own on-paper language is ARC based. Although for D, it would probably be better to add actors and limit actors from calling nogc code, then emit barriers for all gc code and use incremental collection. Incremental collection would be good for game-world collection as you could call it between iterations and specify it to complete in 5ms or something.
Nov 23 2020
On Monday, 23 November 2020 at 12:10:27 UTC, Ola Fosheim Grøstad wrote:On Monday, 23 November 2020 at 11:54:24 UTC, Paulo Pinto wrote:It is always about theory, in practice tracing GC always wins. While we are on the subject Herb Sutter's talk on C++ deferred pointers talk at CppCon (aka tracing GC, as he points out half way through the talk). https://www.youtube.com/watch?v=JfmTagWcqoE https://github.com/hsutter/gcpp A design that influenced C++/WinRT, which uses background threads and clever uses of modern C++ to reduce the impact of RC on program performance. Still they are slower than tradicional .NET/Win32 applications.Other bad news is that if you don't want the runtime to look bad against tracing GC implementations, https://github.com/ixy-languages/ixy-languages You need to ship your own CPU with ARC specific improvments, https://blog.metaobject.com/2020/11/m1-memory-and-performance.htmlNot exactly sure what you mean by this. Swift isn't really representative of what you can achieve with ARC. Swift is designed to be easy to use and compatible with Obj-C semantics. ARC can also improve over time as more theory about shape analysis of heap patterns becomes available and you can gradually improve pointer analysis passes over time. The key issue is to not provide the programmer with manual acquire/release or any way to access the ref count. Also, in D owning!T would be nonatomic, and owning!shared(T) would be atomic unless the compiler can prove that it isn't shared yet. My own on-paper language is ARC based. Although for D, it would probably be better to add actors and limit actors from calling nogc code, then emit barriers for all gc code and use incremental collection. Incremental collection would be good for game-world collection as you could call it between iterations and specify it to complete in 5ms or something.
Nov 23 2020
On Monday, 23 November 2020 at 12:36:07 UTC, Paulo Pinto wrote:It is always about theory, in practice tracing GC always wins.That really depends, but a tracing GC is easier to use, as it catches cycles. So it would be better to have an incremental collector. But I don't think D can get there within 5 years, and do people want to discuss what D could have in 5 years? I think we need to figure out what the time frame should be. You could get non-optimized ARC in 6 months. And basic optimized ARC in 12 months. Optimized ARC in 18 months. Opiimized ARC with borrow checker in 24 months. That is a lot more attractive IMO. Open Source should focus on strategies which can be done as small incremental steps and ARC can be made compatible with std::shared_ptr when it is allocated with std::make_shared. That is a big plus.
Nov 23 2020
On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:One of the things I mentioned is that I don't get why library solutions are pursued for handling memory allocations/garbage collecting when the runtime already exists and can be used for the same purpose.A benefit of the library solution is that the user can always create their own implementation when needed. You can write your own malloc in C, which is useful if you want to program an os... (for example)A library solution actively requires the user to specify the kind of memory management they want. This is not what most modern programmers need to care about. A runtime solution means that if you want to switch between ARC GC and a traditional mark/sweep GC then you just swap the runtime implementation out. The user's code does not change, and it should not need to.I'm not a gamedev but I can imagine that (unlike most programmers) they care about it. You might want to use ARC for resources on the GPU, but mark and sweep on CPU. You could use region-based memory management for some objects to optimize performance.So tl;dr - DIP, but I can't think about writing one for a few months because time, but there's bound to be interesting discussion that can come up as a result of this.Would it be possible that you have different pointer types, but code which doesn't care about it is somehow generic?
Nov 22 2020
On Sunday, 22 November 2020 at 20:49:19 UTC, random wrote:A benefit of the library solution is that the user can always create their own implementation when needed.The runtime is 100% overridable by the user. Walter continually says that the linker will just take the most recent symbol provided, ignoring symbols provided by the pack-in static libraries. We even have the beginnings of a gamedev focused runtime in the works. Whatever, they're symbols the linker expects to find, we can define them however we want.
Nov 22 2020
On Sunday, 22 November 2020 at 20:49:19 UTC, random wrote:On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:Actually no, you cannot not, at least not with pure ISO C. Allocating from a global static buffer yes, but for something like a proper malloc() taking from a OS wide memory pool, either inline Assembly, external Assembly or compiler intrisics are required to interface with the memory management hardware. If we are talking about GCC C, clang C, MSVC, TI C, aCC, xlC,... then yeah C can do it. This is one of my trick questions, how to implement malloc() in ISO C on bare metal.One of the things I mentioned is that I don't get why library solutions are pursued for handling memory allocations/garbage collecting when the runtime already exists and can be used for the same purpose.A benefit of the library solution is that the user can always create their own implementation when needed. You can write your own malloc in C, which is useful if you want to program an os... (for example)
Nov 22 2020
On Sunday, 22 November 2020 at 19:54:14 UTC, Ethan wrote:On Sunday, 22 November 2020 at 14:30:45 UTC, Ethan wrote:I've been looking into this and the main issue that has caused slow progress in templatizing the runtime is the fact that the hooks need to be ` trusted pure nogc nothrow`. Why? Because those hooks may get called from ` trusted pure nogc nothrow` code and you do not want the user getting errors like "you cannot do that because our runtime implementation is not pure". This leads to all sorts of problems: some functions cannot be pure, others cannot be nogc etc. I don't know if this can be fixed without a major redesign of druntime. Actually, I'm not even sure that all of the hooks can be `pure nogc nothrow`....longer form discussion about the exact kind of GC we want in game development...So chatting with Atila on beerconf. The conversation that comes up, apart from this needing to be a DIP, is that I need to fill out some of the ideas that I have here. One of the things I mentioned is that I don't get why library solutions are pursued for handling memory allocations/garbage collecting when the runtime already exists and can be used for the same purpose. This led to highlighting that the runtime should be more templatised anyway so that it can get that deeper knowledge of objects via DbI. The runtime as designed and implemented is about ten years behind how the language progressed, so there's definitely some work that needs to happen there.
Nov 22 2020
On Monday, 23 November 2020 at 03:27:48 UTC, RazvanN wrote:I've been looking into this and the main issue that has caused slow progress in templatizing the runtime is the fact that the hooks need to be ` trusted pure nogc nothrow`. Why? Because those hooks may get called from ` trusted pure nogc nothrow`trusted I understand, but the others should be correctly inferred be a template anyway and if they can't be.... so be it. There are already druntime functions you can't use from nogc, they're just special cased in the compiler instead picked up from the implementation...
Nov 22 2020
On Monday, 23 November 2020 at 03:44:02 UTC, Adam D. Ruppe wrote:On Monday, 23 November 2020 at 03:27:48 UTC, RazvanN wrote:What about purity? If your code is pure but the runtime hook is not? And then there are many functions like this in druntime: void checkSomething(T)(T a) trusted nothrow nogc { /* some other checks */ assert(a != fun(), "Fail"); /* some other checks */ } Let's say this function is used everywhere in druntime. You cannot mark it as pure because the compiler will then optimize it away and if you need it you just have to duplicate the code. Also if you want to format the message of the assert, normally you would use `~` however, you want your function to be nogc so then you have to use the existing crippled AssertFormat in druntime which may not be enough for your needs. My point is that you have to work around a lot of hindrances to implement this.I've been looking into this and the main issue that has caused slow progress in templatizing the runtime is the fact that the hooks need to be ` trusted pure nogc nothrow`. Why? Because those hooks may get called from ` trusted pure nogc nothrow`trusted I understand, but the others should be correctly inferred be a template anyway and if they can't be.... so be it. There are already druntime functions you can't use from nogc, they're just special cased in the compiler instead picked up from the implementation...
Nov 22 2020
On Monday, 23 November 2020 at 03:53:04 UTC, RazvanN wrote:And then there are many functions like this in druntime:Do you have a specific example in there now? Your little given example uses assert and would thus be compiled out anyway of the normal druntime build.Also if you want to format the message of the assert, normally you would use `~` however, you want your function to be nogcWith the `debug` keyword you can do stuff like this. Of course only sometimes compiled in so not necessarily helpful to druntime but maybe.
Nov 22 2020
On Monday, 23 November 2020 at 04:04:44 UTC, Adam D. Ruppe wrote:On Monday, 23 November 2020 at 03:53:04 UTC, RazvanN wrote:Hmmm, I struggled with this in https://github.com/dlang/druntime/pull/3267 . I did not know that asserts are ignored in normal builds. So typically you would need to manually throw an Error in cases like checking array bounds.And then there are many functions like this in druntime:Do you have a specific example in there now? Your little given example uses assert and would thus be compiled out anyway of the normal druntime build.Also if you want to format the message of the assert, normally you would use `~` however, you want your function to be nogcWith the `debug` keyword you can do stuff like this. Of course only sometimes compiled in so not necessarily helpful to druntime but maybe.
Nov 22 2020
This is a step in the right direction, but as usual, when will we see the results? - GC that doesn't eat my precious memory - GC that doesn't stop the world - GC that doesn't affect the frame budget for a game That is it, requirements are simple I agree and i hear, GC is welcome in D, so be proud of it, and make it great! if nobody can, then drop it and implement some sort of ARC/RC what ever it is called, that would be better than having something that stop the world Whoever has GC knowledge, open a patreon account and i'll give you my money
Nov 24 2020
On Wednesday, 25 November 2020 at 05:55:39 UTC, ryuukk_ wrote:This is a step in the right direction, but as usual, when will we see the results? - GC that doesn't eat my precious memory - GC that doesn't stop the world - GC that doesn't affect the frame budget for a game That is it, requirements are simple I agree and i hear, GC is welcome in D, so be proud of it, and make it great! if nobody can, then drop it and implement some sort of ARC/RC what ever it is called, that would be better than having something that stop the world Whoever has GC knowledge, open a patreon account and i'll give you my moneyARC/RC also stops the world, hence the typical optimization to move the referenced data to a background thread when the reference count reaches zero for cleanup, and use of deferred/hazardous pointers. Which when coupled with a couple of other optimizations, it becomes hardly indistinguishable from basic tracing GC algorithms.
Nov 24 2020
On Wednesday, 25 November 2020 at 06:21:21 UTC, Paulo Pinto wrote:ARC/RC also stops the world, hence the typical optimization to move the referenced data to a background thread when the reference count reaches zero for cleanup, and use of deferred/hazardous pointers. Which when coupled with a couple of other optimizations, it becomes hardly indistinguishable from basic tracing GC algorithms.Except that it's an algorithm oblivious to the involved heap sizes. And that it doesn't require heuristics how to handle the different "generations" (as there are none). And that it requires much less memory. And that it works well with custom destructors.
Nov 24 2020
On Wednesday, 25 November 2020 at 06:21:21 UTC, Paulo Pinto wrote:ARC/RC also stops the world, hence the typical optimization to move the referenced data to a background thread when the reference count reaches zero for cleanup, and use of deferred/hazardous pointers.ARC does not stop the world. Algorithms that need hazard should do their own. ARC should be as light as it can be. D is for systems programming.
Nov 24 2020
On Wednesday, 25 November 2020 at 07:43:23 UTC, Ola Fosheim Grostad wrote:ARC does not stop the world.He means the "unbounded" destruction phase when an enormous data structure needs to be free()d. This problem -- if it really comes up -- is not part of the reference counting mechanism at all. Manual memory management with free() calls produces exactly the same effect.
Nov 24 2020
Unity moving to incremental GC https://www.youtube.com/watch?v=5Fks2NArDc0
Nov 24 2020
On Wednesday, 25 November 2020 at 07:58:13 UTC, ryuukk_ wrote:Unity moving to incremental GCBut they have the money for it. What would you charge for implementing one that is fine tuned for D? I've given it some thought and concluded that it would be rather risky to take it on with less than 2 years pay... So if we do it as a collective spare time project it would take at least 5 to get to something that could even approach ARC. That's a very rough estimate. Maybe pessimistic, but the risk is that it leads to something unusable, and then you have wasted a lot of resources for nothing. With ARC you can be certain that you have something that can complement manual strategies.
Nov 25 2020
On Wednesday, 25 November 2020 at 07:58:13 UTC, ryuukk_ wrote:Unity moving to incremental GC https://www.youtube.com/watch?v=5Fks2NArDc0I love the irony there. Two top game engines in the world use garbage collection (Unity, Unreal), and the problem they _had_ is: a missed frame 60fps to 30fps (I wouldn't be able to see it). The example to show this is of course a FPS game where players can see this. It's not a common game genre to make for most companies if I understand. That problem would probably be solvable will less memory allocation. But it hurts developer experience so the engine deals with that. "The GC is perfectly adequate in high-performance scenario" would be a logical conclusion. BUT In the blogging and recruiting world though, Amazon will say on the AWS blog that "Because Rust does not require a runtime or garbage collector, it is able to achieve runtime performance similar to C and C++." https://aws.amazon.com/fr/blogs/opensource/why-aws-loves-rust-and-how-wed-like-to-help/ People really do like the idea that GC prevents top performance, disregarding that _Fortnite_ has a garbage collector.
Nov 25 2020
On Wednesday, 25 November 2020 at 09:05:16 UTC, Guillaume Piolat wrote:Two top game engines in the world use garbage collection (Unity, Unreal), and the problem they _had_ is: a missed frame 60fps to 30fps (I wouldn't be able to see it). The example to show this is of course a FPS game where players can see this.I dont know. In my experience dropped frames are annoying in smooth artistic scenes. You want to suspend disbelief to create immersion.
Nov 25 2020
On Wednesday, 25 November 2020 at 09:36:41 UTC, Ola Fosheim Grostad wrote:I dont know. In my experience dropped frames are annoying in smooth artistic scenes. You want to suspend disbelief to create immersion.btw, Ive had a lot if headaches over missed frames when doing even simple animations in browsers. Large objects with linear motion and high contrast makes missing frames very noticable. For some reason it looks even worse to me when objects move slow, probably because the object is more in focus and the eye tracks it better. You can make it less noticable by adding blur and use less linear motion, but why should I have to waste hours on such tweaks just because the tech is shitty?
Nov 25 2020
On Wednesday, 25 November 2020 at 09:52:20 UTC, Ola Fosheim Grostad wrote:On Wednesday, 25 November 2020 at 09:36:41 UTC, Ola Fosheim Grostad wrote:🤷♂️ Can't change your opinion about JavaScript. I know 100s of online games (including MMORPGs) are using it. So D with GC can totally do it too.I dont know. In my experience dropped frames are annoying in smooth artistic scenes. You want to suspend disbelief to create immersion.btw, Ive had a lot if headaches over missed frames when doing even simple animations in browsers. Large objects with linear motion and high contrast makes missing frames very noticable. For some reason it looks even worse to me when objects move slow, probably because the object is more in focus and the eye tracks it better. You can make it less noticable by adding blur and use less linear motion, but why should I have to waste hours on such tweaks just because the tech is shitty?
Nov 25 2020
On Wednesday, 25 November 2020 at 14:24:08 UTC, aberba wrote:🤷♂️ Can't change your opinion about JavaScript. I know 100s of online games (including MMORPGs) are using it. So D with GC can totally do it too.I am not discussing JavaScript, the Chrome team has put a massive effort into improving the bad situation with dropped frames over the past years for good reason. Their GC is in a different ballpark than D. Consistency is king, 30hz without dropped frames is perceived as more fluid than 60hz with dropped frames. A sidescroller with fixed speed looks like a trainwreck if you get dropped frames.
Nov 25 2020
On Wednesday, 25 November 2020 at 09:05:16 UTC, Guillaume Piolat wrote:On Wednesday, 25 November 2020 at 07:58:13 UTC, ryuukk_ wrote:+1. Couldn't have said it any better.[...]I love the irony there. Two top game engines in the world use garbage collection (Unity, Unreal), and the problem they _had_ is: a missed frame 60fps to 30fps (I wouldn't be able to see it). The example to show this is of course a FPS game where players can see this. It's not a common game genre to make for most companies if I understand. [...]
Nov 25 2020
On Wednesday, 25 November 2020 at 07:54:57 UTC, Araq wrote:On Wednesday, 25 November 2020 at 07:43:23 UTC, Ola Fosheim Grostad wrote:It could happen in a game where you can teleport, but ARC can be combined with scene allocators. So if you delete the whole scene you would not need to deallocate individual objects.ARC does not stop the world.He means the "unbounded" destruction phase when an enormous data structure needs to be free()d. This problem -- if it really comes up -- is not part of the reference counting mechanism at all. Manual memory management with free() calls produces exactly the same effect.
Nov 25 2020
On Wednesday, 25 November 2020 at 08:25:33 UTC, Ola Fosheim Grostad wrote:On Wednesday, 25 November 2020 at 07:54:57 UTC, Araq wrote:Which is also possible alongside tracing GC implementations.On Wednesday, 25 November 2020 at 07:43:23 UTC, Ola Fosheim Grostad wrote:It could happen in a game where you can teleport, but ARC can be combined with scene allocators. So if you delete the whole scene you would not need to deallocate individual objects.ARC does not stop the world.He means the "unbounded" destruction phase when an enormous data structure needs to be free()d. This problem -- if it really comes up -- is not part of the reference counting mechanism at all. Manual memory management with free() calls produces exactly the same effect.
Nov 25 2020
On Wednesday, 25 November 2020 at 10:24:28 UTC, Paulo Pinto wrote:Which is also possible alongside tracing GC implementations.If it allows for separate pools.
Nov 25 2020
On Wednesday, 25 November 2020 at 11:01:06 UTC, Ola Fosheim Grostad wrote:On Wednesday, 25 November 2020 at 10:24:28 UTC, Paulo Pinto wrote:Indeed, and I have used them in Go, Java and .NET, so D can easily do it.Which is also possible alongside tracing GC implementations.If it allows for separate pools.
Nov 25 2020
On Wednesday, 25 November 2020 at 11:24:27 UTC, Paulo Pinto wrote:On Wednesday, 25 November 2020 at 11:01:06 UTC, Ola Fosheim Grostad wrote:Didn't know Go had that in, cool. :) I wonder if D's fork collector supports this?If it allows for separate pools.Indeed, and I have used them in Go, Java and .NET, so D can easily do it.
Nov 25 2020
On Wednesday, 25 November 2020 at 11:39:05 UTC, Ola Fosheim Grostad wrote:On Wednesday, 25 November 2020 at 11:24:27 UTC, Paulo Pinto wrote:What is so special about having memory allocated over OS APIs and then making of the language features (using/SafeHandles, try, defer) to create arenas?On Wednesday, 25 November 2020 at 11:01:06 UTC, Ola Fosheim Grostad wrote:Didn't know Go had that in, cool. :) I wonder if D's fork collector supports this?If it allows for separate pools.Indeed, and I have used them in Go, Java and .NET, so D can easily do it.
Nov 25 2020
On Wednesday, 25 November 2020 at 13:01:20 UTC, Paulo Pinto wrote:On Wednesday, 25 November 2020 at 11:39:05 UTC, Ola Fosheim Grostad wrote:It isnt sufficient to have arenas you need to prove that there are no pointers crossing the pool boundaries?On Wednesday, 25 November 2020 at 11:24:27 UTC, Paulo Pinto wrote:What is so special about having memory allocated over OS APIs and then making of the language features (using/SafeHandles, try, defer) to create arenas?On Wednesday, 25 November 2020 at 11:01:06 UTC, Ola Fosheim Grostad wrote:Didn't know Go had that in, cool. :) I wonder if D's fork collector supports this?If it allows for separate pools.Indeed, and I have used them in Go, Java and .NET, so D can easily do it.
Nov 25 2020
On Wednesday, 25 November 2020 at 07:54:57 UTC, Araq wrote:This problem -- if it really comes up -- is not part of the reference counting mechanism at all. Manual memory management with free() calls produces exactly the same effect.That's not true. The problem with reference counting is that the deallocation happens behind your back, and can be difficult to reason about or occur inconsistently. With manual free calls, everything happens explicitly, and you have more flexibility about it. All this aside the fact that, for games, automatic memory management isn't competing with 'malloc', it's competing with custom arenas. Where you can deallocate everything at once and not have to worry about tracing an object graph. Malloc is fairly slow as is, and the overhead of reference counting on top of it is generally acceptable (esp. with optimizations), but rc still has pathological cases.
Nov 25 2020
On Wednesday, 25 November 2020 at 08:32:37 UTC, Elronnd wrote:On Wednesday, 25 November 2020 at 07:54:57 UTC, Araq wrote:That's about implicit vs explicit code, still not about the refcounting mechanism. And the flexibility remains in the implicit code, move an owner to a different thread/owning data structure.This problem -- if it really comes up -- is not part of the reference counting mechanism at all. Manual memory management with free() calls produces exactly the same effect.That's not true. The problem with reference counting is that the deallocation happens behind your back, and can be difficult to reason about or occur inconsistently. With manual free calls, everything happens explicitly, and you have more flexibility about it.All this aside the fact that, for games, automatic memory management isn't competing with 'malloc', it's competing with custom arenas. Where you can deallocate everything at once and not have to worry about tracing an object graph. Malloc is fairly slow as is, and the overhead of reference counting on top of it is generally acceptable (esp. with optimizations), but rc still has pathological cases.Areas still have pathological cases where you never free anything whatsoever in a runaway loop...
Nov 25 2020
On Thursday, 26 November 2020 at 23:09:12 UTC, ryuukk_ wrote:https://technology.riotgames.com/news/leveraging-golang-game-development-and-operationsOops forgot to add my text As maybe people said, the industry doesn't mind the GC, as long as the job is done in an efficient way, GO gc seems to scale super well, since GO is opensource, is it possible to somewhat copy their GC, add their GC as a custom GC (since you can setup your own GC in D)
Nov 26 2020
On Thursday, 26 November 2020 at 23:10:41 UTC, ryuukk_ wrote:On Thursday, 26 November 2020 at 23:09:12 UTC, ryuukk_ wrote:Why no EDIT feature on the forum? i shouldn't type after drinking this much for thanksgiving lolhttps://technology.riotgames.com/news/leveraging-golang-game-development-and-operationsOops forgot to add my text As maybe people said, the industry doesn't mind the GC, as long as the job is done in an efficient way, GO gc seems to scale super well, since GO is opensource, is it possible to somewhat copy their GC, add their GC as a custom GC (since you can setup your own GC in D)
Nov 26 2020
On 27/11/2020 12:11 PM, ryuukk_ wrote:Why no EDIT feature on the forum? i shouldn't type after drinking this much for thanksgiving lolThis is not a forum. It is a mailing list with a fancy web interface.
Nov 26 2020
On Friday, 27 November 2020 at 05:20:11 UTC, rikki cattermole wrote:On 27/11/2020 12:11 PM, ryuukk_ wrote:It's a newsgroup with a mailing list interface and a fancy web interface.Why no EDIT feature on the forum? i shouldn't type after drinking this much for thanksgiving lolThis is not a forum. It is a mailing list with a fancy web interface.
Nov 27 2020
On Thursday, 26 November 2020 at 23:10:41 UTC, ryuukk_ wrote:On Thursday, 26 November 2020 at 23:09:12 UTC, ryuukk_ wrote:It doesn't need to be opensource as such, the point is "as long as the job is done". Even C and C++, now the elite languages of game development were seen back in the day as "Unity", because any serious game developer would be using Assembly (or C, by the time C++ started gaining some traction). This is relatively easy to check still, you just need to go dig a bit on archives from books, magazines and BBS/USENET posts. One day theses sources will eventually vanish though, and with luck some do end up in some sort of museum. Many also forget that before a language gets traction to be used in games, it has gone through the long path of adoption via tool building. This is where Java and .NET started to gain traction initially, by replacing MFC based tools, and then being the languages used for the server side. Not everyone is doing Crysis (I guess it is time to replace the example with Fortnight, written in Unreal C++/Blueprints, with their GC infrastructure), and as proven by Minecraft, there is more to be successful in games than if the language has a GC or not. Besides, everyone using DirectX or Metal, is using a GC (reference counted based) on their game stack anyway.https://technology.riotgames.com/news/leveraging-golang-game-development-and-operationsOops forgot to add my text As maybe people said, the industry doesn't mind the GC, as long as the job is done in an efficient way, GO gc seems to scale super well, since GO is opensource, is it possible to somewhat copy their GC, add their GC as a custom GC (since you can setup your own GC in D)
Nov 26 2020
On Thursday, 26 November 2020 at 23:10:41 UTC, ryuukk_ wrote:On Thursday, 26 November 2020 at 23:09:12 UTC, ryuukk_ wrote:That web page was for servers... No, we cannot copy their GC. Also, Go code is slowed down because of it. The easy path to fast GC with LLVM is single threaded.https://technology.riotgames.com/news/leveraging-golang-game-development-and-operationsOops forgot to add my text As maybe people said, the industry doesn't mind the GC, as long as the job is done in an efficient way, GO gc seems to scale super well, since GO is opensource, is it possible to somewhat copy their GC, add their GC as a custom GC (since you can setup your own GC in D)
Nov 26 2020
On Friday, 27 November 2020 at 07:36:04 UTC, Ola Fosheim Grostad wrote:On Thursday, 26 November 2020 at 23:10:41 UTC, ryuukk_ wrote:Better be usable at game servers or game related pipeline tooling, than not being used anywhere, but I guess the communityOn Thursday, 26 November 2020 at 23:09:12 UTC, ryuukk_ wrote:That web page was for servers... No, we cannot copy their GC. Also, Go code is slowed down because of it. The easy path to fast GC with LLVM is single threaded.https://technology.riotgames.com/news/leveraging-golang-game-development-and-operationsOops forgot to add my text As maybe people said, the industry doesn't mind the GC, as long as the job is done in an efficient way, GO gc seems to scale super well, since GO is opensource, is it possible to somewhat copy their GC, add their GC as a custom GC (since you can setup your own GC in D)
Nov 27 2020
On Friday, 27 November 2020 at 08:11:40 UTC, Paulo Pinto wrote:Better be usable at game servers or game related pipeline tooling, than not being used anywhere, but I guess the pie.Why would one of the current GCs be a problem on a server? Memory? Well, in that case Rust will win.
Nov 27 2020
On Friday, 27 November 2020 at 09:00:02 UTC, Ola Fosheim Grostad wrote:On Friday, 27 November 2020 at 08:11:40 UTC, Paulo Pinto wrote:It wouldn't, hence why I think it is better outcome focusing on proving a good experience on engines like Godot, similar to what Making this https://github.com/sheepandshepherd/godot-d-plugin appear here https://docs.godotengine.org/en/stable/tutorials/plugins/editor/ aking_plugins.html, would do so much more for adopting D in game development circles than yet another half baked attempt to reboot the GC. Meanwhile, indie devs will start with something like Godot, search the web for how to continue, land on https://dotnet.microsoft.com/apps/games and carry on from there, regardless of what the community keeps trying to do to atract an imaginary set of game developers, because "booooo GC".Better be usable at game servers or game related pipeline tooling, than not being used anywhere, but I guess the the pie.Why would one of the current GCs be a problem on a server? Memory? Well, in that case Rust will win.
Nov 27 2020
On Friday, 27 November 2020 at 09:16:57 UTC, Paulo Pinto wrote:https://docs.godotengine.org/en/stable/tutorials/plugins/editor/ aking_plugins.html, would do so much more for adopting D in game development circles than yet another half baked attempt to reboot the GC.Maybe something for people interested in existing frameworks. I am more interested in WASM and ARC is the only sensible solution.
Nov 27 2020
On Friday, 27 November 2020 at 09:16:57 UTC, Paulo Pinto wrote:Meanwhile, indie devs will start with something like Godot, search the web for how to continue, land on https://dotnet.microsoft.com/apps/games and carry on from there, regardless of what the community keeps trying to do to atract an imaginary set of game developers, because "booooo GC".+1 It's all about having top-down libraries that nails one domain. - having a library that allows to do X where X is not trivial - **with a nice API**, this is the styling on the car - being willing to manage/engage a community around that lib - having a plan for monetization Godot has incredibly nice API. It can make 2D games. It's quite innovative with the nested pre-fab, however it's not sure it's a big factor in its success. It needs dedication! Libraries are like products, they must sell some big goal, not "parse this format" which is a bottom-up approach. Products are top-down.
Nov 27 2020
On Friday, 27 November 2020 at 14:56:03 UTC, Guillaume Piolat wrote:It's all about having top-down libraries that nails one domain. - having a library that allows to do X where X is not trivial - **with a nice API**, this is the styling on the carYes, but that is not a language feature. If you want to create a framework like that you are better off stripping down flutter and implement the gameworld in Dart: instant support for ios, android and web.
Nov 27 2020
On Friday, 27 November 2020 at 15:08:38 UTC, Ola Fosheim Grostad wrote:On Friday, 27 November 2020 at 14:56:03 UTC, Guillaume Piolat wrote:I'm not discounting that D is a nice language (if people say they can't use anything else after knowing D, that says a lot really), I'm saying that the traits that make people switch to a new language are desirable properties of the _library they want to use_, more than the language. It has been proven in research papers about programming language adoption.It's all about having top-down libraries that nails one domain. - having a library that allows to do X where X is not trivial - **with a nice API**, this is the styling on the carYes, but that is not a language feature.If you want to create a framework like that you are better off stripping down flutter and implement the gameworld in Dart: instant support for ios, android and web.Soft disagree. This sounds to me like a high-debt solution. If you make a game engine for example, cost of making N games is O(N), but cost of having a new platform is O(1). If added value flow to the game engine properly, you _will_ end up having support for all platforms needed. You can totally start with only one platform (aka segmentation), actually Unity has started with a one plateform: https://techcrunch.com/2019/10/17/how-unity-built-the-worlds-most-popular-game-engineIts story began on an OpenGL forum in May 2002, where Francis posted a call for collaborators on an open source shader-compiler (graphics tool) for the niche population of Mac-based game developers like himself. It was Ante, then a high school student in Berlin, who responded.Unity had one platform and solved a smaller problem.
Nov 27 2020
On Friday, 27 November 2020 at 20:41:33 UTC, Guillaume Piolat wrote:really), I'm saying that the traits that make people switch to a new language are desirable properties of the _library they want to use_, more than the language.Yes, or the service it runs on. Which is why I think D ought to encourage separating framework from app. Let the framework do the multithreading and let the app author write simple single threaded tasks. So basically the framework deals with shared and app authors can mostly ignore that... That would be a good reason to have single threaded GC, which also would enable fast 100% precise collection and correct destruction and RAII. I think we could even get the destructor order right. However, ARC is more generally useful... For me.Soft disagree. This sounds to me like a high-debt solution. If you make a game engine for example, cost of making N games is O(N), but cost of having a new platform is O(1). If added value flow to the game engine properly, you _will_ end up having support for all platforms needed.Godot does not even support Metal or Direct X? For web I actually only want really efficient debuggable wasm. The browser is the framework and apps should load and run in 1 second. Flutter is a bit bloated, but probably less bloated than unity/godot... And better UI support... But generally speaking... Frameworks are more a hindrance for what I want to achieve. Anyway, my point was more: if your goal is to build a framework, then you would not do it to promote a specific language. So I dont think the D community can decide this to be a focus. We can only focus on the enabling language features, getting rid of the irritatiting pain points. (Why is typing on ipads so... Nggh?)
Nov 27 2020
On Friday, 27 November 2020 at 21:08:28 UTC, Ola Fosheim Grostad wrote:Anyway, my point was more: if your goal is to build a framework, then you would not do it to promote a specific language. So I dont think the D community can decide this to be a focus."framework" word really is the point of conflict. It is supposed to be a bad thing, you should prefer "libraries"! That's what people say, but in reality people want a cohesive, framework-like experience, with all kinds of problems already solved and tutorial'ed before they get aware of the issue. "library" experience is not cohesive enough and will even feel ugly to some. Your library really is domain-specific after all. That's what I discovered making Dplug, who has a few users. Promoting D was certainly not a goal, rather it was "using D because it's practical".(Why is typing on ipads so... Nggh?)Well you definitely have some grit there :)
Nov 27 2020
On Friday, 27 November 2020 at 22:02:43 UTC, Guillaume Piolat wrote:"framework" word really is the point of conflict. It is supposed to be a bad thing, you should prefer "libraries"! That's what people say, but in reality people want a cohesive, framework-like experience, with all kinds of problems already solved and tutorial'ed before they get aware of the issue.Focused frameworks are good if they are written to coexist with others. I guess a framework has more of a runtime/service feel to it than a library? I guess service might be a useful term. It signals that you have a clean separation/encapsulation, not too fragmented interface. The library approach might be flexible, but harder to learn as you get more parts, less encapsulation and basically end up spending too much time reading docs/tutorials. I rember the first time I opened a window on X-windows. 800 lines. Waaaayyyy too flexible.That's what I discovered making Dplug, who has a few users. Promoting D was certainly not a goal, rather it was "using D because it's practical".Yes, good libraries and frameworks usually distill patterns discovered in developing concrete applications. Which is why, I guess, standard libraries often feel uhm... Inadequate, as they have been conjured from ideas that appeared elegant on paper. But those ideas often turn into idiomatic religion... STL code tend to be clumsy for instance... Writing your own libs for C++ leads to much better looking code. At some point... Create your own idioms. Life is too short.
Nov 27 2020
On Friday, 27 November 2020 at 22:24:05 UTC, Ola Fosheim Grostad wrote:On Friday, 27 November 2020 at 22:02:43 UTC, Guillaume Piolat wrote:So here are plenty of examples using Go in WASM with a 2D games framework. https://ebiten.org/examples/ https://medium.com/a-journey-with-go/go-image-rendering-in-2d-video-games-with-ebiten-912cc2360c4f Enough juice to do Flash style games.[...]Focused frameworks are good if they are written to coexist with others. I guess a framework has more of a runtime/service feel to it than a library? I guess service might be a useful term. It signals that you have a clean separation/encapsulation, not too fragmented interface. The library approach might be flexible, but harder to learn as you get more parts, less encapsulation and basically end up spending too much time reading docs/tutorials. I rember the first time I opened a window on X-windows. 800 lines. Waaaayyyy too flexible.[...]Yes, good libraries and frameworks usually distill patterns discovered in developing concrete applications. Which is why, I guess, standard libraries often feel uhm... Inadequate, as they have been conjured from ideas that appeared elegant on paper. But those ideas often turn into idiomatic religion... STL code tend to be clumsy for instance... Writing your own libs for C++ leads to much better looking code. At some point... Create your own idioms. Life is too short.
Dec 01 2020
On Tuesday, 1 December 2020 at 08:46:06 UTC, Paulo Pinto wrote:On Friday, 27 November 2020 at 22:24:05 UTC, Ola Fosheim Grostad wrote:Here's an interesting paper from MSR about doing precise ARC. Basically it seems like a handful of compiler optimization passes to eliminate most RC operations at compile time. https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdfOn Friday, 27 November 2020 at 22:02:43 UTC, Guillaume Piolat wrote:[...]
Dec 09 2020
On Wednesday, 9 December 2020 at 19:02:50 UTC, Ben Jones wrote:On Tuesday, 1 December 2020 at 08:46:06 UTC, Paulo Pinto wrote:Thanks fo sharing, I will certainly read this later when I have more time. Xmas?:)On Friday, 27 November 2020 at 22:24:05 UTC, Ola Fosheim Grostad wrote:Here's an interesting paper from MSR about doing precise ARC. Basically it seems like a handful of compiler optimization passes to eliminate most RC operations at compile time. https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdfOn Friday, 27 November 2020 at 22:02:43 UTC, Guillaume Piolat wrote:[...]
Dec 09 2020
On Wednesday, 9 December 2020 at 19:02:50 UTC, Ben Jones wrote:On Tuesday, 1 December 2020 at 08:46:06 UTC, Paulo Pinto wrote:Thanks, quite interesting read.On Friday, 27 November 2020 at 22:24:05 UTC, Ola Fosheim Grostad wrote:Here's an interesting paper from MSR about doing precise ARC. Basically it seems like a handful of compiler optimization passes to eliminate most RC operations at compile time. https://www.microsoft.com/en-us/research/uploads/prod/2020/11/perceus-tr-v1.pdfOn Friday, 27 November 2020 at 22:02:43 UTC, Guillaume Piolat wrote:[...]
Dec 09 2020
On Friday, 27 November 2020 at 07:36:04 UTC, Ola Fosheim Grostad wrote:On Thursday, 26 November 2020 at 23:10:41 UTC, ryuukk_ wrote: The easy path to fast GC with LLVM is single threaded.But only if the thread has low memory footprint. The downside of a fast scan is that it may wipe out all caches, thus slowing down nongc threads. To combat that you either need memory barriers to get incremental collection, which most likely require a language change, or you can only collect very slowly. So well, ARC.
Nov 27 2020
On Sunday, 22 November 2020 at 14:30:45 UTC, Ethan wrote:There's many nuanced points to consider here, so given that GC came up on the live Q&A and I got in to a bit of a chat there I figured copy/pasting that log and getting in to a (real, stop-saying-gamedev-doesn't-want-this) longer form discussion about the exact kind of GC we want in game development. There's a few people in the community here that are involved in console game dev, and they would know the kind of characteristics we require. Similarly, many of the lower level programmers that work with GPUs and the like are well aware that garbage collection is not good enough for releasing resources outside of the main system environment and would know the kind of control we require over deallocation and release paths. [snip]Maybe organize a group to meet once a week to discuss issues and a path forward?
Nov 22 2020