really the big sin of java and .net's GC is they keep wanting to pretend they don't exist. a GC should always be explicit. let me know you are going to stop the world so i can immediately go fail the health check and stop routing jobs to me while i clean up my gigabyte stack of shit

@icedquinn Not sure I agree. The whole point of the GC not being explicit is to reduce human error, and it does a good job at that. Java performance compared to many other interpreted languages is exceptional (not so much .net).

You also do have the ability to "suggest" the invocation of garbage collection should you need to add some explicit control to speed things up. but it rarely makes much of a difference.

@freemo they stop the world without telling the process, which is the sin. nim used an incremental gc (until they rewrote it all to use refcounting :blobcatshrug2:) so we could collect between game frames. the hoard of c# games doesn't scavenge time when its opportune and just framedrops at random ass times.

there's a lot of deployments where its actually fine for the GC to stop the world, it just needs to tell the load balancer about it ahead of time

@icedquinn

> they stop the world without telling the process

No not really. The GC doesnt freeze your program, it is smart enough to work within the idle time most of the time. You'd be hard pressed to get the GC to glitch your program or slow things down compared to manually doing it. If you do it manually and do a really good job in almost all situations I you will likely get improvements so minimal you could barely measure it.

@freemo not talking about the total clock time to collect. ref counting does constantly pay that cost. talking about the response time.

with a GC there i always a threat of sudden syncopation

@icedquinn If you are worried about momentary latency at moments when latency is super critical then use the Java Real-time specification, JSR1

@freemo it's really not that hard to communicate with a GC in the form of

"hey, this is a good stop point. do you want to stop?" and if yes, signal the service down and go to sleep until its done repacking the 8gb heap.

java/c# don't let you do that, though.
@icedquinn @freemo

So many Enterprise software and server solutions still use Java for their critical infrastructure today.

I worked for an S3-compatible company that uses Cassandra for the DB and all the other components were made in Java....GC definitely caused issues. The GC disadvantages must not outway the benefits of Java

@verita84

I have heard that claim many times... every single time when I investigated it wasnt true and came down to user error (or a lack of understanding in the mechanics of the GC)... Probably 200 times in my career as the guy consultant people call in to fix other peoples mess.

Pbviously in your case I cant say much more without seeing the code or knowing more of the problem... but not once has the GC ever actually turned out to be the problem in the end.

@icedquinn

In 35 years of using GC in various forms, the only real tradeoff I've ever encountered is increased memory use. Typically, it is double, but if you reuse objects (add to collect to "free"), that can be reduced (at the expense of now introducing possible "reuse while still in use" bugs).

@sdgathman

Yea absolutely, the inefficient usage of memory in terms of spaces is entirely legit. In fact thats part of the reason its so fast, because it pre-slates the memory too (meaning it uses the memory regardless of if you use it or not)... but also object storage can be more expensive since it wont clean up right away...

The age old tradeoff of more space being consumed for the advantage of faster speed.

@icedquinn @verita84

Also, C-Python has a very space efficient GC by using reference counting in addition to normal GC. The vast majority of objects are collected when their refcnt goes to 0. The GC is needed for the occasional cycles. The refcnt overhead is trivial compared to the interpreter overhead.
Follow

@sdgathman

I mean, if you need a space-effecient GC there are quite a few options. Of course the issue with Python is the GIL, less of an issue in C-Python though.

@icedquinn @verita84

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.