Skip to content

Implement efficient MessageQueue for improved performance #285

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 4 commits into
base: main
Choose a base branch
from

Conversation

HoberMin
Copy link

@HoberMin HoberMin commented Apr 8, 2025

Description

This PR implements a new MessageQueue class to improve the performance of message handling in the InMemoryTransport. The implementation uses an efficient index-based approach instead of array operations.

Key changes:

  • Add new MessageQueue class in shared directory
  • Implement efficient FIFO operations (O(1) complexity)
  • Add comprehensive test coverage
  • Refactor InMemoryTransport to use the new MessageQueue

Motivation and Context

The previous implementation used array operations (shift/push) which have O(n) complexity. The new implementation provides O(1) operations for better performance with large message queues.

Type of changes

  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Performance improvement

How Has This Been Tested?

  • Added dedicated test suite for MessageQueue
  • All tests pass successfully
  • Tested FIFO operations, length management, peek functionality, and clear operations

Checklist:

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • All new and existing tests passed
  • My changes generate no new warnings

@HoberMin HoberMin changed the title feat: Implement efficient MessageQueue for improved performance Implement efficient MessageQueue for improved performance Apr 8, 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.

1 participant