Comment by adastra22
6 months ago
That's a very long time. Milliseconds of work is an entire frame update-render cycle in a modern game.
6 months ago
That's a very long time. Milliseconds of work is an entire frame update-render cycle in a modern game.
Would your modern game have a stack that is so deep that it brushes up against the stack height limit?
Probably not. Your game would be inches of stack away from crashing
You're missing the point, they're giving an example of an entire workload that fits into your technique's worst-case overhead. It's could be the right trade-off and rarely be hit, but that worst-case does sound bad.
Stacks tend to be small enough that the cost of scanning them is minuscule.
(I’m not trying to BS my way here - I’m explaining the reason why on the fly GC optimization almost never involves doing stuff about the time it takes to scan stack. It’s just not worth it. If it was, we’d be seeing a lot of stacklet type optimizations.)
From what he describes, he uses stack maps to tell which stack values are pointers. He can skip over everything that's not a pointer.
On x86_64 you need about 10k function deep stack, all of them with the 14 GPs filled with pointers -to have an 1MB stack.
2 replies →
^ this was the intent of the example.
Actually, it sounds quite ok.
Games don't tend to have very deep callstacks. And if a game cared about performance also wanted to use GC, it would probably try to run the GC at the end of a frame when there is little on the stack.
Yeah UE GC safepoints at end of tick where there is no stack. That’s a common trick in systems that have both GC and ticking.
To be fair, FUGC doesn’t currently let you do that. The GC runs in a separate thread and soft handshakes at various points, which cause your game thread to react at poll checks and exits that might not be at end of tick.
But I could add a feature that lets you to force handshake responses to be at end of tick! That sounds like a good idea
FUGC runs the GC in a separate thread and you don’t have a lot of control over when it interrupts.
Latency-sensitive programs like games are usually careful to avoid deep recursion.