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

Fix memory leak and improve performance #33

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MP0w
Copy link

@MP0w MP0w commented Nov 6, 2023

  1. unsubscribe didn't remove the index from the map
  2. subscribe needed to create an array of all keys to get the next index
  3. the map used arrays to store all indexes, replaced with a Set for faster lookup
  • Added tests before the fix to verify it still works fine
  • Tested performance of adding 100K subscribers and publishing a message:
    new implementation: 85ms
    old implementation: 120 sec

MP0w added 4 commits November 6, 2023 19:02
1. unsubscribe didn't remove the index from the map
2. subscribe needed to create an array of all keys to get the next index
3. the map used arrays to store all indexes, repalced with a Set
@MP0w MP0w closed this Nov 9, 2023
@MP0w MP0w reopened this Nov 10, 2023
@MP0w
Copy link
Author

MP0w commented Nov 10, 2023

must have closed it by mistake

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