@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.
> 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.
@icedquinn If you are worried about momentary latency at moments when latency is super critical then use the Java Real-time specification, JSR1
Nah, usually the problem is the coders are just clueless as to how to properly work with the GC. Its very common to have shitty coders when it comes to performance issues.
You joke but to be fair what seperates an expert from a noob is nuance like this. An expert probably wouldnt make those sorts of little mistakes too often to begin with.
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.
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.
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.
Java lets you do that.
System.gc()
If you call that it prioritized the GC, except you dont need to stop. you can keep running and the GC will clean up the 8gb heap without needing to stop your program at all (though you are welcome to stop if you have nothign to do and speed up the GC a bit I guess).
@freemo i guess you’re not reading anything i’m saying before responding, because there are only so many ways i can rephrase the following
if gc.needs_to_run:
consul.health_check = hcStop
defer: consul.health_check = hcGood
gc.collect
Did you read what I said... as I said you can do that... you just have no need to stop and restart the health check. Though you can if you really want to for some reason.
System.gc(), call it when you have downtime, you now just accomplished what you wanted.
@icedquinn If you use C and traditional malloc and free calls to allocate memory as needed on a per object basis, it is actually **significantly** slower than Java's GC and memory allocation, for example.
If you use a library to pre-slate your memory and do a few really special stuff (thus removing you from access to malloc directly) you will get speeds comparable to Java at best.
You would have a really hard time beating Java's GC manually.
@icedquinn @freemo I remember reading that Erlang has a funny way of handling that. It has a stop-the-world GC, except it's per process and Erlang is optimised to handle things with a crapton of small processes with small heaps. So your program cleans up tiny patches of garbage all the time, each process fast enough to be imperceptible.
I always wanted to make something in Erlang but never had a good project idea that fits it. Elixir also sounds interesting but again, wtf do I use it for, I'm not about to start implementing an nth Pleroma.
Java has several GC options that wont stop the world and ones that are super low latency as well as ones that are time constant (takes the same time to freeup a 100 TB heap as it does a 1KB heap)..
It is quite extrodinary how performant the Java GC is, out of all the memory managed languages it is probably the most efficient, if you know how to use it.
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