Conversation
🦋 Changeset detectedLatest commit: 1afdf00 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: +16 B (+0.02%) Total Size: 65 kB
ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 1.18 kB ℹ️ View Unchanged
|
samwillis
left a comment
There was a problem hiding this comment.
This is great.
My main comment is that hashIndex.ts and valueIndex.ts are small files, and indexes.ts isn't that large, could we fold them into indexes.ts?
If you would prefer to keep them separate can we name them hash-index.ts and value-index.ts.
Other than that it's great. let get it merged!
|
@samwillis i would prefer to keep them as separate files. Regarding the naming of the files, it seems that the |
|
ah, ok lets leave as is 👍 |
5c16993 to
1afdf00
Compare
This PR modifies the index such that it is a composition of two indexes:
As long as a key only has a single value associated to it, it is stored in the single value index and no hashes are computed. Once a key has two or more distinct values, it is moved to the multi value index where they are distinguished based on their hash.
This ensures that objects are distinguished by structural equality (as is needed by differential dataflow) and not by referential equality (as is the case with objects in JS). Thus guaranteeing correctness while also minimizing the amount of hashes that are computed.