Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RollingWindow.GetEnumerator performance #8443

Closed
3 tasks done
starteleport opened this issue Dec 4, 2024 · 0 comments · Fixed by #8444
Closed
3 tasks done

Improve RollingWindow.GetEnumerator performance #8443

starteleport opened this issue Dec 4, 2024 · 0 comments · Fixed by #8444

Comments

@starteleport
Copy link
Contributor

starteleport commented Dec 4, 2024

Rationale

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.

Potential Solution

#8444

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant