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

Explore using a sorted dictionary to store messages in memory #116

Open
dlqqq opened this issue Dec 9, 2024 · 0 comments
Open

Explore using a sorted dictionary to store messages in memory #116

dlqqq opened this issue Dec 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@dlqqq
Copy link
Member

dlqqq commented Dec 9, 2024

Problem

A sorted dictionary is a dictionary which allows O(1) value access by key, and maintains a well-defined ordering of keys.

This data representation is perfect for getting messages, where there are two key operations which ideally should run in O(1) time:

  • Get all messages / last K messages in order
  • Get 1 message by its ID

Proposed Solution

Explore using a sorted dictionary to store messages in memory. One issue is that I don't think pycrdt has a sorted dictionary shared type, but it may still be possible for each YChat instance to maintain its own sorted dictionary in-memory.

@dlqqq dlqqq added the enhancement New feature or request label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant