You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ScriptList::FillList should charge some reasonable number of opcodes, e.g. based on the size of the pool or the number of pool items which end up in the list.
Actual result
ScriptList::FillList doesn't charge anything, even though it may consume very large amounts of CPU-time. Charging a correspondingly large number of opcodes can mitigate the performance degradation caused by scripts.
Charging a large number of opcodes may also encourage script authors to pursue more efficient methods.
Steps to reproduce
See ScriptList::FillList
The text was updated successfully, but these errors were encountered:
Indeed filtering using API function is free, but using custom filter written in squirrel is not.
List constructors were free before introduction of FillList.
I agree applying filter while construction should have a cost, but I think it should be less than the Valuate cost (which is 5+call per item).
The script should be charged even if a filter isn't used.
To take a random example, AIVehicleList() iterates the whole vehicle pool and populates it with all the companies head vehicles.
ScriptList is rather slow and memory-hungry so this wastes a lot of CPU time and memory even if nothing is filtered.
It would be a perverse incentive to make unfiltered lists free but charge for filtered lists, when making ScriptList instances as small as possible (e.g. by filtering) is preferable.
Version of OpenTTD
master
Expected result
ScriptList::FillList should charge some reasonable number of opcodes, e.g. based on the size of the pool or the number of pool items which end up in the list.
Actual result
ScriptList::FillList doesn't charge anything, even though it may consume very large amounts of CPU-time. Charging a correspondingly large number of opcodes can mitigate the performance degradation caused by scripts.
Charging a large number of opcodes may also encourage script authors to pursue more efficient methods.
Steps to reproduce
See ScriptList::FillList
The text was updated successfully, but these errors were encountered: