Skip to content

Conversation

@thanay-sisir
Copy link

@thanay-sisir thanay-sisir commented Dec 30, 2025

🚀 Summary

Refactors the difficulty filtering mechanism in the rollout buffer to improve performance and maintainability. Replaces chained conditional logic with a dictionary-based lookup, reducing complexity from O(n) to O(1).

🛠 Key Changes

  • Refactor: Replaced multiple if/elif comparisons with a direct difficulty_mapping dictionary lookup.
  • Logic:
    • 0.0 reward → hard
    • 1.0 reward → easy
    • Others → normal
  • Extensibility: Centralized mapping logic makes future difficulty granularities easier to implement.

⚡ Performance Impact

  • Time Complexity: Constant time O(1) lookup.
  • Efficiency: Reduces CPU cycles and branch prediction misses during high-frequency rollout processing.

@samsja
Copy link
Member

samsja commented Dec 30, 2025

I don't think that the extra logic is usefull / needed. Thanks for your contribution tho

@samsja samsja closed this Dec 30, 2025
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.

2 participants