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

Replaced refs with snowflakes #536

Merged
merged 1 commit into from
Jan 3, 2024
Merged

Replaced refs with snowflakes #536

merged 1 commit into from
Jan 3, 2024

Conversation

scohen
Copy link
Collaborator

@scohen scohen commented Jan 2, 2024

Despite my idea of creating refs to represent IDs of syntactic elements, they are not globally unique, and can be reused when the VM restarts. This makes them inappropriate for long-lived ids, like we need in the index.

I've replaced them with snowflakes, which i benchmarked at 800k qps, are unique, and also represent the time they were created, which means we'll not need to store dates in the index. After the change, lexical's index was 50 MB smaller.

Despite my idea of creating refs to represent IDs of syntactic
elements, they are not globally unique, and can be reused when the VM
restarts. This makes them inappropriate for long-lived ids, like we
need in the index.

I've replaced them with snowflakes, which i benchmarked at 800k qps,
are unique, and also represent the time they were created, which means
we'll not need to store dates in the index. After the change,
lexical's index was 50 MB smaller.
@scohen scohen force-pushed the snowflakes_as_ids branch from 7df21dc to 756d0a4 Compare January 2, 2024 22:38
Copy link
Collaborator

@scottming scottming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snowflakes seems like a good option, but this library appears to have been unmaintained for a while.

@scohen
Copy link
Collaborator Author

scohen commented Jan 3, 2024

but this library appears to have been unmaintained for a while.

I've used this library before, it's fast, it's correct and it's done. Worst case, we fork it.

@scohen scohen merged commit 136010d into main Jan 3, 2024
7 checks passed
@scohen scohen deleted the snowflakes_as_ids branch January 3, 2024 17:04
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.

3 participants