site banner

Small-Scale Question Sunday for January 8, 2023

Do you have a dumb question that you're kind of embarrassed to ask in the main thread? Is there something you're just not sure about?

This is your opportunity to ask questions. No question too simple or too silly.

Culture war topics are accepted, and proposals for a better intro post are appreciated.

3
Jump in the discussion.

No email address required.

If I'm understanding you correctly, which I may not - doing a single comparison-then-branch every "tick" is free and not worth worrying about, unless you're doing millions of ticks per second or something. There isn't really a smarter way because one comparison per tick is nothing compared to billions of instructions per second. As you say you could while(true) { run_100_ticks(); check_timers(); } but I don't see the benefit.

Yeah, that's basically what I'm asking.

When you're doing stuff at scale, avoiding constant checks is pretty important. Factorio saves a ton of update time by putting unused entities to sleep and not having them periodically check if it's time to wake up; they go completely inactive in updates until an active entity connected to them pings them to do something.

When you have 55,000 robot arms not checking if they need to move every tick, the performance savings are measurable.