Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 14:49:42 UTC, Atila Neves wrote: On Monday, 6 March 2017 at 05:50:01 UTC, Rico Decho wrote: It's actually rather rare to *need* to avoid the GC -- only niche applications need that, like if you're writing a game engine that has to avoid stop-the-world pauses (which can be easily worked around, btw), or real-time medical applications where if it stops for 10ms somebody dies. 90% of real world programs out there work just fine with the GC. Actually it's my case. I'd LOVE to use D for game development for instance, but I won't take the risk of having the GC pause the game when I don't want to, even for just an unknown amount of milliseconds, and even if I know that anyway I'll try to limit dynamic allocations by using caches etc. If this isn't a perfect example of D's marketing problem I don't know what is. Someone who likes D and takes the time to write on the forum yet thinks the GC will randomly run no matter what. To make it abundantly clear: I'm not bashing on you in the slightest, Rico Decho. I'm just pointing out that there's a clear problem here in that we can't expect to convert e.g. C++ game developers who have never written a line of D before if we haven't even managed to educate the community yet. "Unfortunately, I have no ideas on how to remedy the situation. " A start would be to link this page prominently from near the front page: https://p0nce.github.io/d-idioms/#The-impossible-real-time-thread https://dlang.org/articles.html
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tuesday, 7 March 2017 at 16:26:20 UTC, Russel Winder wrote: Learn the lesson from Java. It started with a truly crap GC and everyone said Java is crap because the GC is garbage. D has seemingly actually progressed beyond this stage technically but not marketing wise. The Java folk worked on the GC and kept replacing it over and over again. The GC got better and better. Now with the G1 GC almost all the problem have gone away – as has most of the moaning about Java having a crap GC. Most people never notice the GC and those that do, engineer it rather than moaning. The Java GC situation is now a sophisticated one where those who don't really care do not have a problem and those that do care have the tools to deal with it. D seems to be in a situation where those who don't care have a crap GC which needs to be improved and those who do care have the tools to deal with it. So there needs to be ongoing replacement of the D GC until there is something good, this is a technical problem. Obviously D generates less garbage... It's really a problem of social organisation as well - as you say in the rest of your post. For example Sociomantic released their parallel GC, but it's only a solution for linux and not Windows because no fork on Windows. Why isn't it available in a form that will work with latest dmd master? Because we haven't collectively been able to organise someone to do the work, and nobody has stepped up to do it voluntarily. (And similarly with other GC alternatives - I know that memory barriers have problems too). But it's probably a matter of time only, because resources are beginning to flow into supporting the language. The D Foundation didn't exist a couple of years ago - and things didn't magically change once it came into existence. It takes time and the repeated application of effort, but over time it's likely to bear fruit in different ways. Things develop at their own pace, and more complex things develop more slowly. That people who care about the effect of GC still think D is a crap GC-based language implies there is a marketing problem, not a technical one. Yes, but that's okay too. Maybe it's a pity if you would like to work in D, and the smaller size of community means more limited opportunities. But there are jobs in D, and they are growing. In the meantime, for those who are able to judge things by how they are and not depend on social proof, it might be a source of strategic advantage to adopt the language earlier - and pay the inevitable toll for that, because it is true that the tooling isn't yet completely mature. Eg some things we worked on: https://github.com/dlang/dub/pulls/John-Colvin We all know that many, many people see the word garbage collector and run a mile in an uneducated prejudiced way. Who cares about them. We care about the people who are willing to try stuff out and have a problem. Yes - exactly. Though we can't wave a wand and make problems disappear unless someone is willing to work on them or sponsor development. One thing that's lacking is a central list of projects that would benefit the language and community that enterprise users might sponsor. There's the bug bounty program, but that's something a bit different. Laeeth.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tuesday, 7 March 2017 at 18:45:55 UTC, Rico Decho wrote: D seems to be in a situation where those who don't care have a crap GC which needs to be improved and those who do care have the tools to deal with it. So there needs to be ongoing replacement of the D GC until there is something good, this is a technical problem. That people who care about the effect of GC still think D is a crap GC-based language implies there is a marketing problem, not a technical one. But I don't think that D's GC is fine for people who care about it. You'd have to be a lot more specific on what exactly you care about, since GC always deals with tradeoffs. If it is, why are people on this forum giving advices on how to disable and/or avoid it for soft real-time applications where a GC freeze can't be tolerated. Because there are applications where the tradeoffs chosen for D's GC can't be tolerated. D's GC isn't a crap at all, but better designs and implementations exist, and Nim's GC is one of them. Better implementations of the same design, probably, but I haven't checked. As far as I've been able to discern on a quick look, Nim's current GC is also a mark-and-sweep GC, with the same tradeoffs as D's GC, i.e. if you can't accept D's GC in an application, you cannot accept Nim's. Better designs? That, again, depends on what tradeoffs you're willing to make. For the goal "we want throughput on-par with C" I'm not aware of better designs. We can either learn from it, or ignore it... But the second solution won't make D more appropriate for soft real-time scenarios... You'll have to be very explicit in what you think we should learn. And D is perfectly viable for real-time scenarios: Don't call the GC.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tuesday, 14 March 2017 at 10:05:54 UTC, Russel Winder wrote: [...] My gut feeling is that the D language execution and data model is not compatible with a "do not stop the world" GC. However this is opinion not really backed with evidence. I've recently been made aware of [1] and [2]. GC seems to always be a question of what you're willing to sacrifice, and if you want low pause times AFAIK the only known way to get that is to sacrifice overall throughput. This seems to be contradictory to D's goals of efficiency and control to me. What needs to happen is for a group of people who like complaining about the GC to get together and gather evidence as to what needs to change in the D language to support a soft real-time compatible GC such as Go, Nim, Java G1, etc. You can't just transplant an algorithm since the GC has to fit with the language data and execution model and D is more like C than like Java or Go. If the result is that a change to the D execution or data model is needed then this has to be proposed and debated. If this is not something open to change, then there is no point in going any further. The problem with changing D's execution and/or data model is that AFAIK to be viable for a better GC the necessary sacrifices will ensure that D cannot compete with C in terms of performance anymore. I'm not sure how the majority of the D community would feel about that, but I don't think I at least could still advocate D as a better drop-in replacement for C. I cannot commit to being involved in anything such as this until 2017- 06-30Y17:01+01:00, but from then there is a good possibility of getting me on board an effort to create a new GC for D (but note I really abhor the Phobos coding style with it's wrongly place opening braces). OT: That's what (GIT) commit hooks are for. Write how you want, automatically commit as whatever non-Allman, wrong style the project uses. [1] https://blog.plan99.net/modern-garbage-collection-911ef4f8bd8e?gi=78635e05a6ac#.6zz5an77a [2] http://www.infognition.com/blog/2014/the_real_problem_with_gc_in_d.html
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tue, 2017-03-07 at 11:06 -0800, H. S. Teoh via Digitalmars-d wrote: > On Tue, Mar 07, 2017 at 06:45:55PM +, Rico Decho via Digitalmars- > d wrote: > [...] > > But I don't think that D's GC is fine for people who care about it. > > > > If it is, why are people on this forum giving advices on how to > > disable and/or avoid it for soft real-time applications where a GC > > freeze can't be tolerated. > > > > D's GC isn't a crap at all, but better designs and implementations > > exist, and Nim's GC is one of them. > > > > We can either learn from it, or ignore it... But the second > > solution > > won't make D more appropriate for soft real-time scenarios... > > What the D GC needs is somebody willing to sit down and actually > spend > the time to improve/rewrite the code. Over the years there has been > an > endless stream of fancy ideas, feature requests, and wishlists for > the > GC, but without anybody actually doing the work, nothing will > actually > happen. We are all very well aware of the current GC's limitations > and > flaws for years now, and there has been some amount of improvements > going into it over the years. But again, talking about it won't > magically make it better. *Somebody* has to write the code, after > all. > > If anyone is interested to help, take a look at: > > https://github.com/dlang/druntime/pull/1603 As mentioned previously I can schedule taking a look at this, but only from 2017-06-30T17:01+01:00 onwards. > and review the code, give some feedback, run the benchmarks yourself, > etc., to prod this PR along. > > If you have other ideas for improving the GC (e.g., adapting ideas > from > Nim's GC), submitting PRs to that effect would be much more effective > than merely talking about it. > > > T > -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tue, 2017-03-07 at 18:45 +, Rico Decho via Digitalmars-d wrote: > > D seems to be in a situation where those who don't care have a > > crap GC which needs to be improved and those who do care have > > the tools to deal with it. So there needs to be ongoing > > replacement of the D GC until there is something good, this is > > a technical problem. That people who care about the effect of > > GC still think D is a crap GC-based language implies there is a > > marketing problem, not a technical one. > > But I don't think that D's GC is fine for people who care about > it. > > If it is, why are people on this forum giving advices on how to > disable and/or avoid it for soft real-time applications where a > GC freeze can't be tolerated. Because an option that may be sensibly available for those that cannot cope with a GC language is for D to have a GC-less mode – at the expense of not using Phobos. Of course soft-real time and GC are not incompatible except in some people's minds: it is entirely possible to have GC in a soft real-time system, if the programming language supports it. The question here is only whether the current GC allows D to be used for soft real time. > D's GC isn't a crap at all, but better designs and > implementations exist, and Nim's GC is one of them. > > We can either learn from it, or ignore it... But the second > solution won't make D more appropriate for soft real-time > scenarios... The question is who is the "we" here. A lot of people have a lot of opinions on D and it's GC, including me. However, it seems that none of the people expressing opinions are willing to do anything other than express opinions on the email list. My gut feeling is that the D language execution and data model is not compatible with a "do not stop the world" GC. However this is opinion not really backed with evidence. What needs to happen is for a group of people who like complaining about the GC to get together and gather evidence as to what needs to change in the D language to support a soft real-time compatible GC such as Go, Nim, Java G1, etc. You can't just transplant an algorithm since the GC has to fit with the language data and execution model and D is more like C than like Java or Go. If the result is that a change to the D execution or data model is needed then this has to be proposed and debated. If this is not something open to change, then there is no point in going any further. I cannot commit to being involved in anything such as this until 2017- 06-30Y17:01+01:00, but from then there is a good possibility of getting me on board an effort to create a new GC for D (but note I really abhor the Phobos coding style with it's wrongly place opening braces). -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Tue, Mar 07, 2017 at 06:45:55PM +, Rico Decho via Digitalmars-d wrote: [...] > But I don't think that D's GC is fine for people who care about it. > > If it is, why are people on this forum giving advices on how to > disable and/or avoid it for soft real-time applications where a GC > freeze can't be tolerated. > > D's GC isn't a crap at all, but better designs and implementations > exist, and Nim's GC is one of them. > > We can either learn from it, or ignore it... But the second solution > won't make D more appropriate for soft real-time scenarios... What the D GC needs is somebody willing to sit down and actually spend the time to improve/rewrite the code. Over the years there has been an endless stream of fancy ideas, feature requests, and wishlists for the GC, but without anybody actually doing the work, nothing will actually happen. We are all very well aware of the current GC's limitations and flaws for years now, and there has been some amount of improvements going into it over the years. But again, talking about it won't magically make it better. *Somebody* has to write the code, after all. If anyone is interested to help, take a look at: https://github.com/dlang/druntime/pull/1603 and review the code, give some feedback, run the benchmarks yourself, etc., to prod this PR along. If you have other ideas for improving the GC (e.g., adapting ideas from Nim's GC), submitting PRs to that effect would be much more effective than merely talking about it. T -- If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
D seems to be in a situation where those who don't care have a crap GC which needs to be improved and those who do care have the tools to deal with it. So there needs to be ongoing replacement of the D GC until there is something good, this is a technical problem. That people who care about the effect of GC still think D is a crap GC-based language implies there is a marketing problem, not a technical one. But I don't think that D's GC is fine for people who care about it. If it is, why are people on this forum giving advices on how to disable and/or avoid it for soft real-time applications where a GC freeze can't be tolerated. D's GC isn't a crap at all, but better designs and implementations exist, and Nim's GC is one of them. We can either learn from it, or ignore it... But the second solution won't make D more appropriate for soft real-time scenarios...
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Mon, 2017-03-06 at 10:22 -0800, H. S. Teoh via Digitalmars-d wrote: > […] > Nevertheless, it's certainly true that D's GC could use a major > upgrade > at some point. While it's not horrible, the present implementation > does > leave more to be desired. Hopefully the various efforts at GC by > forum > members will at some point turn into some major improvements to D's > GC. > There was talk a year or two ago about a precise for D (with fallback > to > conservative GC for cases where that wouldn't work), but I'm not sure > what has come of it. […] Learn the lesson from Java. It started with a truly crap GC and everyone said Java is crap because the GC is garbage. D has seemingly actually progressed beyond this stage technically but not marketing wise. The Java folk worked on the GC and kept replacing it over and over again. The GC got better and better. Now with the G1 GC almost all the problem have gone away – as has most of the moaning about Java having a crap GC. Most people never notice the GC and those that do, engineer it rather than moaning. The Java GC situation is now a sophisticated one where those who don't really care do not have a problem and those that do care have the tools to deal with it. D seems to be in a situation where those who don't care have a crap GC which needs to be improved and those who do care have the tools to deal with it. So there needs to be ongoing replacement of the D GC until there is something good, this is a technical problem. That people who care about the effect of GC still think D is a crap GC-based language implies there is a marketing problem, not a technical one. We all know that many, many people see the word garbage collector and run a mile in an uneducated prejudiced way. Who cares about them. We care about the people who are willing to try stuff out and have a problem. -- Russel. = Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.win...@ekiga.net 41 Buckmaster Roadm: +44 7770 465 077 xmpp: rus...@winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder signature.asc Description: This is a digitally signed message part
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 15:40:54 UTC, Rico Decho wrote: If this isn't a perfect example of D's marketing problem I don't know what is. Someone who likes D and takes the time to write on the forum yet thinks the GC will randomly run no matter what. To make it abundantly clear: I'm not bashing on you in the slightest, Rico Decho. I'm just pointing out that there's a clear problem here in that we can't expect to convert e.g. C++ game developers who have never written a line of D before if we haven't even managed to educate the community yet. Unfortunately, I have no ideas on how to remedy the situation. I also don't know how to get people to stop believing that C is magically fast either, which I think is a similar perception problem. Atila Actually it's written in the documentation. That's true and was pointed out to me on Twitter by a C++ dev. I don't know what's up with that but I'm _pretty_ sure it doesn't happen in practice, but only somebody who knows the GC implementation well can comment I guess. If I remember well the garbage collection could be triggered during any allocation, for instance when concatenating some displayed text, and freeze all threads until the garbage collection is done. Right. So slap `@nogc` on whatever is in the game loop and that's guaranteed to not happen. In my opinion, the problem is D's GC implementation. This is also a problem, yes. For instance, Nim uses a soft (realtime) GC, which is why Nim's author himself has made the Urho3D wrapper :) With this approach, no need to disable the GC and make manual allocations to avoid that the GC freezes all threads. Instead you simply use all the standard libraries as normally, while still try to avoid allocating too much stuff during the rendering of course. During the render loop, in Nim you occasionally call the GC with an numeric argument telling how much milliseconds it is allowed to use in the worst case. That's pretty cool. Atila
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
If you have a lot of total allocated memory, GC may still be somewhat slow (because it has to scan a lot of memory, most of which is still live). One possible approach is to do your large-scale, long-term allocations outside the GC heap (i.e., use malloc) so that the amount of GC memory that needs to be scanned is small. One approach of reducing the amount of GC allocations that people new to D seem to overlook, is to avoid string allocations by using D's range-based algorithms instead. E.g., instead of: auto s = "abc" ~ myString ~ "def"; // lots of allocations writeln(s); Do this instead: import std.range; auto r = chain("abc", myString, "def"); // no allocation writeln(r); This isn't always possible, e.g., if you need to store the result of a concatenation and access it later, but a lot of on-the-fly allocations (i.e., short-term garbage) could be eliminated this way. T PERFECT !!!
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 18:22:53 UTC, H. S. Teoh wrote: but I'm not sure what has come of it. https://github.com/dlang/druntime/pull/1603
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 16:40:02 UTC, bachmeier wrote: GC.disable doesn't guarantee the garbage collector won't run In only exceptional cases deems necessary for correct program behavior, such as during an out of memory condition
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Mon, Mar 06, 2017 at 05:52:40PM +, Rico Decho via Digitalmars-d wrote: > Btw, I'm not promoting Nim here, just asking to take inspiration from > its memory model ;) Nevertheless, it's certainly true that D's GC could use a major upgrade at some point. While it's not horrible, the present implementation does leave more to be desired. Hopefully the various efforts at GC by forum members will at some point turn into some major improvements to D's GC. There was talk a year or two ago about a precise for D (with fallback to conservative GC for cases where that wouldn't work), but I'm not sure what has come of it. [...] > 2/ it uses a standard curly-brace block syntax, which helps a lot when > porting C++ or Node.js code to D. It's kinda ironic how the times have changed, that people these days regard curly-brace block syntax as "standard". I still remember not too many decades ago (har har) when C's curly-brace syntax was regarded as too obscure or line-noise-y, and people preferred "begin ... end", "if .. fi", or similar things popular at the time. T -- Unix is my IDE. -- Justin Whear
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
Btw, I'm not promoting Nim here, just asking to take inspiration from its memory model ;) I've used Nim in the past, and while it's a nice language, D is much closer to perfection regarding my personal needs and tastes. I've actually converted all my Nim scripts to D, because : 1/ it doesn't force you to declare the types and functions before using them; 2/ it uses a standard curly-brace block syntax, which helps a lot when porting C++ or Node.js code to D.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Mon, Mar 06, 2017 at 05:30:56PM +, Rico Decho via Digitalmars-d wrote: > > maybe that's what you're looking for: > > https://dlang.org/phobos/core_memory.html#.GC.collect > > Indeed ! > > I'll try to make some benchmarks with a 3D rendering loop to see how > much time it takes if there is not much to GC. If you have a lot of total allocated memory, GC may still be somewhat slow (because it has to scan a lot of memory, most of which is still live). One possible approach is to do your large-scale, long-term allocations outside the GC heap (i.e., use malloc) so that the amount of GC memory that needs to be scanned is small. One approach of reducing the amount of GC allocations that people new to D seem to overlook, is to avoid string allocations by using D's range-based algorithms instead. E.g., instead of: auto s = "abc" ~ myString ~ "def"; // lots of allocations writeln(s); Do this instead: import std.range; auto r = chain("abc", myString, "def"); // no allocation writeln(r); This isn't always possible, e.g., if you need to store the result of a concatenation and access it later, but a lot of on-the-fly allocations (i.e., short-term garbage) could be eliminated this way. T -- If you want to solve a problem, you need to address its root cause, not just its symptoms. Otherwise it's like treating cancer with Tylenol...
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
maybe that's what you're looking for: https://dlang.org/phobos/core_memory.html#.GC.collect What is nice with Nim it that it has a GC heap PER THREAD. No need to stop the other threads during a GC... https://nim-lang.org/docs/threads.html https://nim-lang.org/docs/manual.html#threads "Nim's memory model for threads is quite different than that of other common programming languages (C, Pascal, Java): Each thread has its own (garbage collected) heap and sharing of memory is restricted to global variables. This helps to prevent race conditions. GC efficiency is improved quite a lot, because the GC never has to stop other threads and see what they reference. Memory allocation requires no lock at all! This design easily scales to massive multicore processors that are becoming the norm." I'd suggest taking inspiration from that for D's memory allocations and garbage collection...
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
maybe that's what you're looking for: https://dlang.org/phobos/core_memory.html#.GC.collect Indeed ! I'll try to make some benchmarks with a 3D rendering loop to see how much time it takes if there is not much to GC.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
GC.disable doesn't guarantee the garbage collector won't run: https://dlang.org/phobos/core_memory.html#.GC.disable I'm not sure how much impact that has in practice. That's why I'd like D to allow also Nim's alternative GC method. https://nim-lang.org/docs/gc.html Basically, you have the choice between a standard GC and a real-time GC. With the real-time version, you ask regularly for a partial time-limited GC. They say you can normally expect it to take less than 2 ms. And you can also decide not to call it if you know that it's not needed at the moment (no resource loading, etc), or if it's the wrong time to call it. What worries C++ game developers like me is not a regular 2 ms GC at each frame, it's actually an occasional 200 ms GC once in a while... Hence the need to allocate manually and disable the GC at the moment.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 15:40:54 UTC, Rico Decho wrote: ... For instance, you ask for GC when the game is in a menu or after a background resource loading. ... maybe that's what you're looking for: https://dlang.org/phobos/core_memory.html#.GC.collect
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 16:42:50 UTC, bachmeier wrote: Writing up a detailed example with code showing how to avoid the GC in the most common situations, posting it on Reddit, and then making it easy to find on dlang.org would be a good start. Given the importance of these issues, it should be one of the first things you see on the homepage. That's a great idea. In fact, I'd like to see multiple examples, with many different approaches to manual memory management, going over the common problems (e.g. "How do I do a writefln in a @nogc block?") and how to solve them in idiomatic D. Something like Rust's guide to unsafe programming. This set of examples could be extended as the upcoming DIPs dealing with resource management make it into D compilers.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 14:49:42 UTC, Atila Neves wrote: Unfortunately, I have no ideas on how to remedy the situation. I also don't know how to get people to stop believing that C is magically fast either, which I think is a similar perception problem. Writing up a detailed example with code showing how to avoid the GC in the most common situations, posting it on Reddit, and then making it easy to find on dlang.org would be a good start. Given the importance of these issues, it should be one of the first things you see on the homepage.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 06:39:27 UTC, Jack Stouffer wrote: void loop() { // code } void loadLevel() { import core.memory : GC; GC.disable(); while(stuff) loop(); GC.collect(); } GC.disable doesn't guarantee the garbage collector won't run: https://dlang.org/phobos/core_memory.html#.GC.disable I'm not sure how much impact that has in practice.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 15:40:54 UTC, Rico Decho wrote: If I remember well the garbage collection could be triggered during any allocation, for instance when concatenating some displayed text, and freeze all threads until the garbage collection is done. My understanding is that GC can be triggered only when you do an allocation with GC memory. And if you use @nogc (which to my knowledge works) you cannot call anything that might trigger a garbage collection. https://dlang.org/spec/attribute.html#nogc
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
If this isn't a perfect example of D's marketing problem I don't know what is. Someone who likes D and takes the time to write on the forum yet thinks the GC will randomly run no matter what. To make it abundantly clear: I'm not bashing on you in the slightest, Rico Decho. I'm just pointing out that there's a clear problem here in that we can't expect to convert e.g. C++ game developers who have never written a line of D before if we haven't even managed to educate the community yet. Unfortunately, I have no ideas on how to remedy the situation. I also don't know how to get people to stop believing that C is magically fast either, which I think is a similar perception problem. Atila Actually it's written in the documentation. If I remember well the garbage collection could be triggered during any allocation, for instance when concatenating some displayed text, and freeze all threads until the garbage collection is done. In my opinion, the problem is D's GC implementation. For instance, Nim uses a soft (realtime) GC, which is why Nim's author himself has made the Urho3D wrapper :) With this approach, no need to disable the GC and make manual allocations to avoid that the GC freezes all threads. Instead you simply use all the standard libraries as normally, while still try to avoid allocating too much stuff during the rendering of course. During the render loop, in Nim you occasionally call the GC with an numeric argument telling how much milliseconds it is allowed to use in the worst case. For instance, you ask for GC when the game is in a menu or after a background resource loading. That's the simple and clever way of using a garbage collected language for game development.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
void loop() { // code } void loadLevel() { import core.memory : GC; GC.disable(); while(stuff) loop(); GC.collect(); } Also see EMSI containers for no gc containers with deterministic destruction https://github.com/economicmodeling/containers Thanks for mentioning the containers, that's exactly what I needed ! Then I think it's worth trying... This week end I'll try to generate the D wrapper for Urho3D and test how to load some scene resources in the background.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 05:50:01 UTC, Rico Decho wrote: It's actually rather rare to *need* to avoid the GC -- only niche applications need that, like if you're writing a game engine that has to avoid stop-the-world pauses (which can be easily worked around, btw), or real-time medical applications where if it stops for 10ms somebody dies. 90% of real world programs out there work just fine with the GC. Actually it's my case. I'd LOVE to use D for game development for instance, but I won't take the risk of having the GC pause the game when I don't want to, even for just an unknown amount of milliseconds, and even if I know that anyway I'll try to limit dynamic allocations by using caches etc. If this isn't a perfect example of D's marketing problem I don't know what is. Someone who likes D and takes the time to write on the forum yet thinks the GC will randomly run no matter what. To make it abundantly clear: I'm not bashing on you in the slightest, Rico Decho. I'm just pointing out that there's a clear problem here in that we can't expect to convert e.g. C++ game developers who have never written a line of D before if we haven't even managed to educate the community yet. Unfortunately, I have no ideas on how to remedy the situation. I also don't know how to get people to stop believing that C is magically fast either, which I think is a similar perception problem. Atila
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 05:50:01 UTC, Rico Decho wrote: Actually it's my case. I'd LOVE to use D for game development for instance, but I won't take the risk of having the GC pause the game when I don't want to, even for just an unknown amount of milliseconds, and even if I know that anyway I'll try to limit dynamic allocations by using caches etc. void loop() { // code } void loadLevel() { import core.memory : GC; GC.disable(); while(stuff) loop(); GC.collect(); } Also see EMSI containers for no gc containers with deterministic destruction https://github.com/economicmodeling/containers
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Monday, 6 March 2017 at 05:50:01 UTC, Rico Decho wrote: Actually it's my case. I'd LOVE to use D for game development for instance, but I won't take the risk of having the GC pause the game when I don't want to, even for just an unknown amount of milliseconds, and even if I know that anyway I'll try to limit dynamic allocations by using caches etc. It's *not* going to pause your game unless you do any allocations in your game loop, because it isn't otherwise going to run. D's GC is perfectly acceptable for games if you just follow the best practices that are already standard in game development. Allocate as much as you can when loading a new level and minimize allocations in the loop. If you do need to allocate during the level, you can avoid the GC entirely and do so via malloc. D provides the means to reduce or eliminate the impact of the GC in your critical loops. When developing games, you should already be trying to minimize allocations in those loops anyway.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
It's actually rather rare to *need* to avoid the GC -- only niche applications need that, like if you're writing a game engine that has to avoid stop-the-world pauses (which can be easily worked around, btw), or real-time medical applications where if it stops for 10ms somebody dies. 90% of real world programs out there work just fine with the GC. Actually it's my case. I'd LOVE to use D for game development for instance, but I won't take the risk of having the GC pause the game when I don't want to, even for just an unknown amount of milliseconds, and even if I know that anyway I'll try to limit dynamic allocations by using caches etc. Of course, for everything else (scripts, tools, servers, etc), now I use D and I'm glad with it. Because for that same scripts and applications, I could have used any other garbage collected language (JavaScript/, C#, etc), so no problem for that. And that's my point. D is probably the best alternative to C++, Java, C# and Node.js. Better than Rust too. But for D to succeed as a viable alternative to C++ where it's mandatory to use it, it must have a minimalistic version of Phobos that makes it easy and natural to use D with manual memory management. Maybe it's already the case, but then I suggest that you should promote it louder, so that people don't even feel the need to try Rust for instance.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Sat, Mar 04, 2017 at 09:06:52AM +, Rico Decho via Digitalmars-d wrote: [...] > Unfortunately C++ developers generally have to use this language in > cases where garbage collected languages like Java and C# wouldn't be > used. > > So D's garbage collector may be a problem to convince most C++ > professional developers, and D may not seem enough of an improvement > for most Java/C# professional developers. Ah, the good ole GC phobia. It was somewhat of a deterrent to me in the beginning too, I admit, but honestly, in retrospect, a lot of the GC phobia among the C/C++ crowd (including myself at the time) amounts to nothing more than unfounded prejudice, mostly stemming from initial impressions of the original GC in Java which was very sucky and had all sorts of problems. Modern GCs addressed most of these problems. Now, it's true that D's current GC needs a lot of improvement, but it really isn't as bad as people seem to think it is. For most applications, it's actually liberating to be able to finally stop thinking about the nitty-gritty of memory management at every turn, and to be able to focus on the actual algorithms at hand. It does require a different mindset than when you're writing C++, though, so this may not click for a while at first. It's actually rather rare to *need* to avoid the GC -- only niche applications need that, like if you're writing a game engine that has to avoid stop-the-world pauses (which can be easily worked around, btw), or real-time medical applications where if it stops for 10ms somebody dies. 90% of real world programs out there work just fine with the GC. IME, many C/C++ folks' GC aversion are actually more religious than anything else. I know C coders who swear against ever using any sort of GC, but then go ahead and (re)invent their own form of GC, albeit full of bugs, design flaws, and nasty unhandled corner cases that real GCs avoid. But of course, they'd never admit that their design was inferior, because GCs suck by definition, and therefore even their most flawed memory management designs must necessarily be better. T -- Why have vacation when you can work?? -- EC
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Friday, 3 March 2017 at 19:49:06 UTC, Jared Jeffries wrote: I think that the programming tutorial using D as the first programming language is what is really need, and fortunately I see that now it's on his way. Ali Çehreli's book is really good in that regard. he explains programming from ground up (i.e. explans bits and bytes and what variable means etc.) in a very straightforward and clever way. It's one of the best programming intro I've seen regardless of the used language. That it uses D is the icing of the cake and as you said, learning D allows to know the concepts used in C, C++, Java and C#. What D needs too is probably more "fame" on the beginners forums. Indeed. How can people start learning a language, if they don't even know it exists, and perfectly fulfill their needs ? To be well known, D just need that people talk about it more for beginners. D is not *just* a language for meta-programming experts and execution speed addicts. IMHO, it's also both the *simplest & complete* alternative to C++, Java and C# out there for people learning OO programming. That must be said on every forum, at each occasion. Stop trying to convince only the expert programmers, most of them are probably not interested in leaving their C++, Java or C# language and IDE for D... Besides the personal preferences, there are real business and technical constraints that make it difficult to change for the "experts". In my work, for instance (big government like institution), there is official IT policy that projects have to be written in Java for Weblogic application servers using Oracle as databases. So if you want support from the IT department, you better use what they offer in their catalogue. I have the luck of working on a legacy project (started in 1993), not very visible but central to the whole business of our directorate, which means that we can force a little bit the hand of the IT department, so that they have to support our historical constraints (the project is a mix of C (99), Oracle Pro*C, perl 5, bash and a java frontend). Now I'm trying to introduce a little bit of D but that will only be possible when we have definitely moved from Solaris/SPARC to Linux/x86_64. TL;DR Difficult to introduce D when the project runs on Solaris/SPARC and interfaces with Oracle DB.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
That's a curious statement, because I was trained mainly as a C/C++ programmer, and still use them for my job every day. I was very well-versed in the intricacies of C, and somewhat C++, yet I was very unhappy with them. For several years I would scour the net during my free time to look for a better language. I wasn't very impressed with D the first time I saw it, for various reasons, and it wasn't until I found a copy of TDPL in a local bookstore and decided on a whim to buy it, that I really got started with D. And the rest, as they say, is history. :D Even though I suspect that I'm in the minority here, I'm pretty sure there's got to be others out there in C/C++ land who are like me, longing for a better language but just haven't found a suitable candidate yet. So don't discount us C/C++ veteran folk just yet! My programming language at work remains C++ too, therefore I agree that D's clean syntax is very attractive to C++ developers. Java and C# are also "post-C++" languages, and thus their syntax is closer to D (imports, reference types, etc). D's clean and powerful syntax may not be as attractive to them. Unfortunately C++ developers generally have to use this language in cases where garbage collected languages like Java and C# wouldn't be used. So D's garbage collector may be a problem to convince most C++ professional developers, and D may not seem enough of an improvement for most Java/C# professional developers. But as it can teach both the C++ and the Java/C# way of programming, as it's syntax has remained close to all of them, D can indeed be "sold" as the best first OO programming language. Learning C++, Java or C# afterwards is quite easy. And once you have tried D, you probably will continue to use it and promote it, like I do.
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
On Fri, Mar 03, 2017 at 07:49:06PM +, Jared Jeffries via Digitalmars-d wrote: > > Yeah. I am actually skeptical of the whole GUI koolaid. I'm pretty > > sure having a GUI is not a necessity to implementing the equivalent > > functionality of an IDE in a text-mode editor. > > Personally I'm using a mix of Geany, Coedit and Code::Blocks for D > development, depending on what I'm doing on that moment (coding, > fixing compilation errors or debugging). > > All three IDE are fine, the GUI "koolaid" works well, and moreover > they start quickly on my venerable Linux laptop. If it works well with your workflow, then all the more power to you! All I'm saying is that, contrary to popular belief, GUI is not a *necessity* to implement the supposed superior features of IDEs over editors. After all, editors *have* advanced in the past 30-40 years too. [...] > Stop trying to convince only the expert programmers, most of them are > probably not interested in leaving their C++, Java or C# language and > IDE for D... That's a curious statement, because I was trained mainly as a C/C++ programmer, and still use them for my job every day. I was very well-versed in the intricacies of C, and somewhat C++, yet I was very unhappy with them. For several years I would scour the net during my free time to look for a better language. I wasn't very impressed with D the first time I saw it, for various reasons, and it wasn't until I found a copy of TDPL in a local bookstore and decided on a whim to buy it, that I really got started with D. And the rest, as they say, is history. :D Even though I suspect that I'm in the minority here, I'm pretty sure there's got to be others out there in C/C++ land who are like me, longing for a better language but just haven't found a suitable candidate yet. So don't discount us C/C++ veteran folk just yet! T -- Many open minds should be closed for repairs. -- K5 user
Re: [OT] Re: Why don't you advertise more your language on Quora etc ?
Yeah. I am actually skeptical of the whole GUI koolaid. I'm pretty sure having a GUI is not a necessity to implementing the equivalent functionality of an IDE in a text-mode editor. Personally I'm using a mix of Geany, Coedit and Code::Blocks for D development, depending on what I'm doing on that moment (coding, fixing compilation errors or debugging). All three IDE are fine, the GUI "koolaid" works well, and moreover they start quickly on my venerable Linux laptop. And I've heard that Visual D is nice too. Obviously there are enough *FREE* efficient D IDE out there, starting fast with just enough visual aid. I think that the programming tutorial using D as the first programming language is what is really need, and fortunately I see that now it's on his way. What D needs too is probably more "fame" on the beginners forums. How can people start learning a language, if they don't even know it exists, and perfectly fulfill their needs ? To be well known, D just need that people talk about it more for beginners. D is not *just* a language for meta-programming experts and execution speed addicts. IMHO, it's also both the *simplest & complete* alternative to C++, Java and C# out there for people learning OO programming. That must be said on every forum, at each occasion. Stop trying to convince only the expert programmers, most of them are probably not interested in leaving their C++, Java or C# language and IDE for D...