Comparing the standard libraries, Phobos doesn't look far behind Go in scope. There are big holes though, like crypto, which is entirely missing, and a complete SQL driver (was in development, but we haven't heard from it for a while now), although there is a binding for SQLite3 and several drivers for major RDBMSs (not in the standard lib, tough). Logging will be included soon. Most of the rest is included (networking uses libCurl), and Phobos quality is continuously improving, some parts of it being excellent both in terms of functionality and performance, like the new regex library. On some other parts, like containers, Phobos seems much more advanced than Go. OTOH, there seems to be more 3-party libraries for Go than for D, but we can't comment on their quality. And of course, both languages allow to bind C libraries.
Re:Go: Severe memory problems on 32bit Linux
by moilolita on Thursday April 05, 2012 @11:27PM
(#3805861)
D has a nice allocation management(i loved the manual+gc approach) and in my benchmarks, optimized D was slightly faster than Go at almost anything and consumed up to 70% less memory (I assumed that was because the Go gc kicked in later and was a bit lazy) but D was weak at threading/synchronization and the documentation of the standard lib was quite messy and lacking. So I decided that in the long run Go will be better (cheap goroutines, channels, good stdlib /documentation + support from google and the prospect of a better GC, all indicated a clear winner).I really hope they fix this cause I can't throw away my atom box and ARM is becoming more and more important.
[ Parent
| on HN ]
Re:Go: Severe memory problems on 32bit Linux
by el_muchacho on Friday April 06, 2012 @04:41AM
(#3806418)
D is pretty strong at concurrency today.
See for instance http://www.informit.com/articles/article.aspx?p=1609144 and
http://ddili.org/ders/d.en/parallelism.html
Re:Go: Severe memory problems on 32bit Linux
by moilolita on Friday April 06, 2012 @05:13AM
(#3806469)
It's strange that with all those threading examples, they didn't notice the need for a WaitGroup primitive. I know that you could implement it yourself. You could simulate the goroutines, implement channels and SCGI/FCGI and so on, but why bother when there is Go ?
Re:Go: Severe memory problems on 32bit Linux
by el_muchacho on Friday April 06, 2012 @06:33AM
(#3806617)
Probably because there is no need for it ? If WaitGroup waits for the end of all tasks to continue, there is map/reduce which should do the trick.
Re:Go: Severe memory problems on 32bit Linux
by complexmath on Friday April 06, 2012 @07:58PM
(#3809462)
Did you mean something like core.sync.barrier?
Re:Go: Severe memory problems on 32bit Linux
by moilolita on Friday April 06, 2012 @08:43PM
(#3809565)
barrier is not a suitable primitive for a WaitGroup. The ideea is simple. You accept sockets in a loop and handle the connections in parallel threads.At one point you want to stop this loop and the main thread must wait for all the active threads to finish before exiting, otherwise some clients may receive "connection reset by peer". With a WaitGroup, every starting thread increments a counter, and every finishing thread decrements it;when the counter is zero -> all the threads finished.The main thread calls WaitGroup.Wait and it remains blocked until all the worker threads finish the jobs. I guess you could simulate it with core.sync.condition
Re:Go: Severe memory problems on 32bit Linux
by complexmath on Saturday April 07, 2012 @11:40AM
(#3811133)
At the program level, this is built in (D has daemon and non-daemon threads like Java). Or you could use ThreadGroup in core.thread. It would be pretty trivial to do this at the user level with messaging as well.
Re:Go: Severe memory problems on 32bit Linux
by he_the_great on Friday April 06, 2012 @02:19PM
(#3808254)
std.concurrency "is a low-level messaging API." The language provides low-level concurrency primitives. It is possible a higher level library providing "goroutines" might be made, though there is not effort or plan.
Re:Go: Severe memory problems on 32bit Linux
by nakkiel on Friday April 06, 2012 @02:31AM
(#3806223)
I wrote a couple of D programs long ago and I still have a taste of an unfinished language. If I recall correctly, arrays manipulation is pretty weird and the language feels a bit the same PHP feels: a bunch of different things pieced together with no coherence. Compared to Python or Go, it's a whole different world.
Re:Go: Severe memory problems on 32bit Linux
by moilolita on Friday April 06, 2012 @04:39AM
(#3806412)
The Phobos standard library is quite unfinished indeed and poorly documented in some areas but the D2 language is rather complete. It has sh*tloads of features but this also makes it a bit harder to master. Go is lighter (very easy to take on) and has an impressive library. Long story short: with D2 I needed ~1 month to get a good grasp of the language and the std library (the library was the hardest part) while with Go I needed around a week.
Re:Go: Severe memory problems on 32bit Linux
by el_muchacho on Friday April 06, 2012 @05:09AM
(#3806457)
Agreed, D is a much bigger and complex language than Go.