Earlier quoted context omitted.
It's more about the memory layout than where the objects live. For example, consider a Point class with (x, y) members. If you have an array of these, each element in the array will be a reference/pointer to a separately allocated Point instance which can be anywhere in the heap. Accessing the array is expensive due to lack of locality (arbitrary memory access). Additionally, each instance has substantial object over…
Value types also give you more control over cache locality. Not having to travel that extra pointer redirection can really add up depending on what you're doing.
Java’s new garbage collector promises low pause times on multi-terabyte heaps
201–210 of 245 posts
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#202Earlier quoted context omitted.
8ms? Where do you get that number from? If your player has a 144Hz monitor then your pause time, rounded to the nearest millisecond, has to be 0ms.
Where do you get your number from? 1/(144 Hz) is 7ms. 1/(60 Hz) is 17ms.
In a 7ms frame, you are spending most of that frame doing the work of rendering the actual frame (unless your game is so trivial that the GC is going to be easy / fast anyway). An additional millisecond is going to cause you to miss your deadline and drop a frame. Dropped frames feel really bad.
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#203Earlier quoted context omitted.
Plenty of people are writing low-latency trading applications in Java where the latency budget is under 100 microseconds. This has been the case for several years now. It's by no means new or even especially difficult these days. The resulting code is far more maintainable and robust than C++ solutions.
I've had the opposite experience. For green-field applications, it's far easier to write the application in C++ than Java & meet the latency requirements. Java requires far too much tuning, where as C++, from the get go, you can generally just glance at the code and have a good idea of the latency. We're currently fighting a Java app that in general has decent latency (10s of usecs), but has outliers of greater than…
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#204Earlier quoted context omitted.
Sounds interesting. Could you explain how so?
Probably just a joke because of the tendency of Java applications (and other garbage collected languages to be honest) to consume an ungodly amount of RAM. Although these days I'd probably blame the web for that...
[1] https://en.wikipedia.org/wiki/Value_type_and_reference_type
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#205Earlier quoted context omitted.
Where do you get your number from? 1/(144 Hz) is 7ms. 1/(60 Hz) is 17ms.
I get my number from decades of professional game programming. In a 7ms frame, you are spending most of that frame doing the work of rendering the actual frame (unless your game is so trivial that the GC is going to be easy / fast anyway). An additional millisecond is going to cause you to miss your deadline and drop a frame. Dropped frames feel really bad.
It's a crazy place here on HN.
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#206Earlier quoted context omitted.
Where do you get your number from? 1/(144 Hz) is 7ms. 1/(60 Hz) is 17ms.
I get my number from decades of professional game programming. In a 7ms frame, you are spending most of that frame doing the work of rendering the actual frame (unless your game is so trivial that the GC is going to be easy / fast anyway). An additional millisecond is going to cause you to miss your deadline and drop a frame. Dropped frames feel really bad.
Also has it really been a decade since Braid? Wow.
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#207Earlier quoted context omitted.
I get my number from decades of professional game programming. In a 7ms frame, you are spending most of that frame doing the work of rendering the actual frame (unless your game is so trivial that the GC is going to be easy / fast anyway). An additional millisecond is going to cause you to miss your deadline and drop a frame. Dropped frames feel really bad.
This sort of stalling is only caused by extremely short lived objects. Pooling and provisioning your data ahead of time goes a long way to fixing these specific issues to the degree that they become unnoticeable. There's a lot of tooling built into LWJGL to support this along with their own vector classes which are easily reclaimed. Also has it really been a decade since Braid? Wow.
Also note that this category of answer is basically saying, "look, if you mostly manage your own memory, then GC takes less time!" That's true, but a large part of the value proposition of GC in the first place was to remove the burden of memory management. Once you are saying actually, GC won't do that for this class of application, then really what you are getting out of GC is memory safety (provided the rest of the language is memory-safe). On the one hand, hey, memory-safety is a benefit. On the other hand, I don't think very many people in game development would trade that much performance just for memory safety.
(And in fact in game development we very often have to do unsafe memory things. So really what ends up being said is "much of the system has memory safety" which, really, does not sound very alluring.)
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#208Earlier quoted context omitted.
No, compression only works when you don't need to represent every possibility, or can use less bytes for some inputs and more bytes for others. https://en.wikipedia.org/wiki/Pigeonhole_principle#Uses_and_...
Why do you need to represent every possibility? You obviously aren't going to squeeze 2^42 objects into 2^42 bytes are you? They each take more than a byte. You don't need to address bytes individually. There's more holes than pigeons here.
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#209Earlier quoted context omitted.
Where do you get your number from? 1/(144 Hz) is 7ms. 1/(60 Hz) is 17ms.
I get my number from decades of professional game programming. In a 7ms frame, you are spending most of that frame doing the work of rendering the actual frame (unless your game is so trivial that the GC is going to be easy / fast anyway). An additional millisecond is going to cause you to miss your deadline and drop a frame. Dropped frames feel really bad.
Re: Java’s new garbage collector promises low pause times on multi-terabyte heaps
#210Earlier quoted context omitted.
This sort of stalling is only caused by extremely short lived objects. Pooling and provisioning your data ahead of time goes a long way to fixing these specific issues to the degree that they become unnoticeable. There's a lot of tooling built into LWJGL to support this along with their own vector classes which are easily reclaimed. Also has it really been a decade since Braid? Wow.
This is true, but it mainly just mitigates the problem. It can never solve the problem, because the whole concept of this kind of scheme is that the memory manager has some volition of its own ... thus it can choose to do things when you don't want or expect (actually this is unavoidable). Also note that this category of answer is basically saying, "look, if you mostly manage your own memory, then GC takes less time!…
that said, the witness is one of my favorite games of all time, so I think its safe to say you know what you're doing