Page 2 of 2

Re: LuaTechnology.level is not consistent

Posted: Tue Oct 01, 2019 11:30 am
by eradicator
PyroFire wrote:
Tue Oct 01, 2019 11:13 am
There is only ever one optimization goal.
Less CPU cycles.
It doesn't matter what it looks like to get the cycles cost down, particularly in this case.
No there are many different optimization goals. CPU usage, Memory usage size, Memory bandwidth usage, Maintanability, Code complexity, etcpp. Many of which preclude each other.
PyroFire wrote:
Tue Oct 01, 2019 11:13 am
eradicator wrote:
Sun Sep 29, 2019 9:55 am
Technology research state does not change "several times per tick". Whatever you're doing there is the wrong approach to the problem and you need to fix the approach, not the "solution".
No, but you may need to call research_level for several different researches under several different functions in the same operation depending on what you're doing - Typically if you need to act based on the research level.
Sounds like premature optimization. You're optimizing for some hypothetical edge case. If that actually was a problem it would be more cpu efficient to cache the result and update the cache in on_technology_researched (sacrificing memory and code complexity). If it *isn't* a problem then the cache is premature optimization again.