News for hackers. Stuff that matters.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by CyberDildonics on Wednesday August 05, 2020 @11:59AM (#24062267)
> This makes maintaining code over time significantly easier, as allocation becomes a hidden implementation detail.

You say that, but there seem to be no end to the stories of people spending enormous amount of time fighting the gc. It is not difficult to avoid heap allocations in other languages as well as freeing them deterministically.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by pron on Wednesday August 05, 2020 @12:38PM (#24062742)
First, you say it as if there aren't event bigger struggles without a GC. So the comparison is not "I'm fighting with the GC vs. I'm not" but "I'm fighting with the GC vs fighting other things, which is better?" So you hear those stories because those are the stories people who use a GC can tell.

Second, as this blog post series shows, the "fight" is not what it used to be. You don't really need to control allocation any more until your rates are really high. Java's GCs have just gotten so much better in JDK 14 and beyond.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by CyberDildonics on Wednesday August 05, 2020 @03:25PM (#24064525)
> First, you say it as if there aren't event bigger struggles without a GC.

I'm extremely skeptical about that. My experience is that with modern C++ you lose very little elegance and gain a huge amount of control by giving up a garbage collector. Memory management becomes a very minor problem. The vast majority of memory allocations are avoided and those that need to be there can be done ahead of time.

I have never heard anyone writing a latency sensitive program in C++ (games, trading etc.) say that their life would be easier if they were using a gc or that they wished they could do it in java. I have however seen decades of people talking about all the extreme lengths and rabbit holes they go down to deal with the java gc.

From a broader perspective, pretty much any language with a gc ends up having a perpetual conversation around how the next gc will solve the problems with the current gc. You can see it in java, go, julia, and D. The only one I never hear about is LuaJIT, but maybe I just haven't seen it or maybe the expectations are lower.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by pron on Wednesday August 05, 2020 @08:28PM (#24067058)
> My experience is that with modern C++ you lose very little elegance and gain a huge amount of control by giving up a garbage collector.

The cost of maintaining a large C++ application (>1MLOC) with a large team over years is very significantly higher than a similar Java application. In some cases the footprint and/or performance benefits are worth that extra cost, but in the vast majority of cases they're not.

> I have however seen decades of people talking about all the extreme lengths and rabbit holes they go down to deal with the java gc.

Again, 1. Java's GCs changed dramatically in the last two years -- the GCs described in the post, are brand new/recently revised and 2. that's because that's Java's particular rabbit hole. C++'s rabbit holes, from undefined behaviour, through partial evaluation with templates and constexprs, to compilation times and sheer language complexity are far deeper.

> I have never heard anyone writing a latency sensitive program in C++ (games, trading etc.) say that their life would be easier if they were using a gc or that they wished they could do it in java.

Their lives would be easier if they could do it in Java, but sometimes they can't. I think that the changes in the last couple of years and the upcoming changes in the next few years will make Java more appropriate even in domains where it hasn't been used before, but it's fine if not. Its market reach is so huge as it is. But games are not often maintained for many years, and telemetry isn't that important, so Java's benefits are not as big as for servers.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by CyberDildonics on Thursday August 06, 2020 @08:45AM (#24070392)
> The cost of maintaining a large C++ application (>1MLOC) with a large team over years is very significantly higher than a similar Java application.

I am very skeptical of this, I don't know why it would be the case. My experience is that with modern C++ and avoiding inheritance programs end up much more direct and clear since a type isn't fragmented into multiple classes and base objects don't need to be used for generic programming and data structures.

> C++'s rabbit holes, from undefined behaviour, through partial evaluation with templates and constexprs, to compilation times and sheer language complexity are far deeper.

This seems like what would be said by someone who has just read a few comments on C++ here and there but not actually used it for non-trivial projects. These are rarely issues. I don't know what 'partial evaluation with templates' means and constexprs didn't even exist until recently. Compilation times do seem to be a big problem, mostly because many projects don't do anything with their structure to mitigate them.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by eigenspace on Wednesday August 05, 2020 @06:50PM (#24066469)
> From a broader perspective, pretty much any language with a gc ends up having a perpetual conversation around how the next gc will solve the problems with the current gc. You can see it in java, go, julia, and D.

Do you have any references handy on the julia bit there? I actually have seen very little conversation in the julia community about replacing or upgrading the GC. Mostly just the ocassional post from an inexperienced user who thinks that a borrow checker would be a good fit for julia.

Discussion seems to almost always revolve around showing users who need it, how to manually manage memory when necessary by pre-allocating arrays, using in-place operations or writing stack allocated code so that they avoid the GC in performance critical code.

I've never seriously used a language without a GC, but my feeling in Julia has always been that I never really had gripes about the GC because it's so easy to avoid the GC and take memory management into my own hands.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by CyberDildonics on Wednesday August 05, 2020 @07:24PM (#24066706)
There were plenty of discussions a few years ago. Julia is probably used the least out of those languages for things that might have latency problems though - servers, guis, games, etc.
Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by eigenspace on Thursday August 06, 2020 @06:57PM (#24076300)
Interesting, in the three years I've been around I've seen little discussion of it. The main people I was aware of who cared about low-latency were robotics people and they mostly found that the techniques for manually managing memory allowed them to avoid the GC and get the latency they needed quite easily.

One complaint I will say I've heard though is that while these people find they can get the allocation behavior they want (i.e. none), some of them would like semantic guarentees that they will not hit allocations, rather than needing to test and make sure their code doesn't start hitting the GC if they switch Julia versions. Someday we might be able to provide such guarantees, but for now GC behavior is just an implementation detail that can change across minor versions.

I can sympathize with those who find that uncomfortable for sure, but in practice, Julia versions have been consistently better at getting more automatic stack allocations, not less, so it hasn't really been a problem.

Re:Sub-10 ms Latency in Java: Concurrent GC with Green Threads by imtringued on Wednesday August 05, 2020 @04:27PM (#24065193)
Lua without a JIT is just a glue language. The expectations are low and LuaJIT is easily smashing them because a lot of Lua code is/was written for the original interpreter.