Skip to content

Optimize update_open_orders function to eliminate unnecessary cloning #68

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

floor-licker
Copy link

Optimization

  • Replaced full HashMap cloning with a more efficient approach that only clones order hashes
  • Used scoped blocks to manage borrows and avoid conflicts
  • Removed the "this is nasty, plz cleanup" comment as the inefficiency is now cleaned up

Why?

The previous implementation:

  1. Wasted memory by cloning all order data, which could be large structures
  2. Used an inefficient workaround for Rust's borrow checker
  3. Was harder to read

Performance Impact

This optimization should reduce memory usage and improve performance, especially when dealing larger numbers of orders. All of the tests are passing with the optimization.

Feel free to reply if there are any questions, I also always appreciate feedback.

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 this pull request may close these issues.

1 participant