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

Use ConcurrentSkipListSet instead of CopyOnWriteArrayList for holding state keys #92

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

Conversation

digitalheir
Copy link

I was digging through the code and I a portion that might benefit from more efficient traversal.

Currently, stateKeys uses CopyOnWriteArrayList, presumably in order to iterate the list at that point while also removing entries from the list. dispose performs a linear search when disposing a screen, filtering all those entries which match the prefix of the screen key.

I reckon:

  1. The search could be speeded up by taking advantage of the orderedness of strings
  2. I thought the list might be better represented as a Set. I've noticed with the master-detail example, clicking an item and going back, that the list was polluted with entries for Screen#0, which should be conflated (right?).

I haven't done a complete implementation for KMM, just want to sketch out the idea and ask if it looks reasonable to you. Perhaps I am overlooking something, like a race condition you're more aware of than I am.

Let me know what you think!

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.

None yet

1 participant