Store each chat in its own key
#481 Store each chat in it's own key
Performance Tests
These are performance tests for _readAllThreads. This is the function that could have worse performance. Attempted to make chat length somewhat representative when testing.
| Number of Chats | Time in ms |
| --------------- | ---------- |
| 100 | 46ms |
| 150 | 60ms |
| 200 | 79ms |
The performance seems good. I could use some help testing performance if anyone has a large chat history!
Hey @andrewpareles, is this what you had in mind for the architecture?
Yeah, generally! Just one small detail - I think we should have another storage item that's an array of all the chats IDs. That way we don't have to list all the keys and filter with a startsWith.
Storage service should effectively be this:
{
CHAT_IDS: [threadId_1, threadId_2, threadId_3, ...],
[threadId_n]: ...chat info...
}
:+1: added a chatIds storage item