would threading hlep the performance just asking im still a beginner
@KeaSigmaDelta10 ай бұрын
Multi-threading can help performance, provided you can break the tasks down into segments that can be run in parallel. For example, running game AI code and physics code on separate cores could help. That said, multi-threaded programming can be a nightmare if you don't know what you're doing. Multi-threading is NOT a solution for the performance issue I mentioned in the video, though. The problem in the video is that the same files keep on being loaded from disk, which is simply wasteful of both processor time and memory. No amount of multi-threading will save you if your game's images can't fit into VRAM. When that happens, your images/textures have to be paged into and out of VRAM multiple times a frame. Even if it does fit into VRAM, having too many copies of the same image would mean that the GPU['s caches can't operate efficiently any more. Why? Because your many copies of the same image become too big to fit into the caches, resulting in more reads from VRAM, and slower performance. This doesn't matter with a small 2D scene like the one in the video, but when you've got 100s of megabytes of textures, and you have 100s of copies of those textures, then you will notice. As hinted at, the solution is a "resource manager," which will ensure that only one copy of a texture (or other resource) is loaded, and that one copy is shared between everything that uses it.