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
The RollingWindow.GetEnumerator method allocates a new list for each invocation and copies values to the list via this[int], which in turn enters/exits reader lock for each invocation. I was able to speed up this method by more than 50% in terms of execution time and achieve marginally better memory consumption by switching from List<T> to T[] and inlining the respective part of this[int].
Many built-in indicators as well as some reasonable real-world use cases for RollingWindow would benefit from this change in backtesting/optimisation.
Rationale
The
RollingWindow.GetEnumerator
method allocates a new list for each invocation and copies values to the list viathis[int]
, which in turn enters/exits reader lock for each invocation. I was able to speed up this method by more than 50% in terms of execution time and achieve marginally better memory consumption by switching fromList<T>
toT[]
and inlining the respective part ofthis[int]
.Many built-in indicators as well as some reasonable real-world use cases for
RollingWindow
would benefit from this change in backtesting/optimisation.Potential Solution
#8444
Checklist
master
branchThe text was updated successfully, but these errors were encountered: