3 ms·
I don't know why LINQ would have any better or worse performance than a standard loop for most tasks. Abusing LINQs will of course lead to degraded performance.
by LarsDu88 1y ago
I don't know why LINQ would have any better or worse performance than a standard loop for most tasks.
Abusing LINQs will of course lead to degraded performance. I've found if you want to insert more logic into your loop, sometimes you have to switch batch to good 'ol loops. I'm sure folks abuse the convenience factor to write more loops rather than modify existing ones which can lead to degraded performance.
For my game it's irrelevant because most linq loops are only triggered by events so there's no loops running on every frame.
For example, lets say you have state machine based AI, and a scripted event triggers tells an enemy starship to change allegiance. The enemy starship then scans a runtime set of enemy factions using LINQ that are within 3 km to identify new targets to attack.
- sieep 1y agoThat makes a lot of sense. Thanks for the response!