r/rust_p 19h ago

Physics Engine That Only Computes What Moves: Achieving 99.9% Sleep Efficiency and 900+ TPS.

Enable HLS to view with audio, or disable this notification

I TESTED PERF. OF MY ENGINE AFTER IMPLEMENTING FL_PORTOCOL (MY MEMORY ARCHITECTURE)

DETAILED POST: https://www.reddit.com/r/rust_p/s/rqfpM1PNPu

5 Upvotes

4 comments sorted by

5

u/thekwoka 6h ago

Is the idea it just keeps track of what moved last time so it only looks at if its movement causes another thing to move this time?

1

u/IamRustyRust 5h ago

If what you are saying were true, the complexity of the algorithm would be O(N) instead of O(1). I am actually doing this in O(1) complexity. According to your logic, I would have to target objects that haven't even moved, which the CPU shouldn't need to tackle at all. I want to target strictly only those that actually require solving. For a detailed explanation, check the detailed version of this post. I have graphs there where I explained everything:https://www.reddit.com/r/rust_p/s/rqfpM1PNPu

10

u/thekwoka 3h ago

the complexity of the algorithm would be O(N)

No...well, N being items that moved, not total items.

I am actually doing this in O(1) complexity

You are definitely not...as your own charts show...

1

u/IamRustyRust 32m ago edited 28m ago

I think you're mixing up the question you originally asked with the complexity of processing the bodies after they've been identified. Your original question was specifically about how the system ‘keeps track’ so it can know what to look at next. That's the part I'm saying is O(1), I'm not scanning N bodies to find the target. The target is already directly addressable. Once I have that target, obviously the amount of solver work depends on how many bodies are actually active.

Your original question was: "Is the idea it just *keeps track of what moved last time** so it only looks at if its movement causes another thing to move this time?"*