On Monday, 31 December 2012 at 12:14:22 UTC, Sven Over wrote:
On Tuesday, 25 December 2012 at 19:23:59 UTC, Jonathan M Davis
wrote:
There's also often no reason not to have the GC on and use it
for certain stuff
One thing that really freaks me out is the fact that the
garbage collector pauses the whole process, i.e. all threads.
In my job I'm writing backend services that power a big web
site. Perfomance is key, as the response time of the data
service in most cases directly adds to the page load time. The
bare possibility that the whole service pauses for, say, 100ms
is making me feel very uncomfortable.
We easily achieve the performance and reliability we need in
C++, but I would love to give D a chance, as it solves many
inconveniences of C++ in an elegant way. Metaprogramming and
the threading model, just to name two.
For instance, arrays would probably be GC-allocated in
general, since
then you can use slices and whatnot,
A smart-pointer type for arrays can easily provide slices. It
keeps a reference to the full array (which gets destructed when
the last reference is dropped), but addresses a subrange.
Thanks everyone for all the replies!
I think the problem would be if you try to append to the slice
(~): If the underlying array is not GC allocated, then it will
append to a new GC allocated array (AFAIK).
As long as you don't append, I'd say you are fine.