clockworklabs / clockworklabs/SpacetimeDB

Consider switching to `foldhash`

Open
#1,872 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

Hashbrown recently switched to foldhash instead of ahash and maybe we should as well.

Perhaps we should split our hashmap/sets into 3 categories:

  1. IntMap/Set -- identity hashing, when we don't need a hash at all, in the case of ids.
  2. FastMap/Set -- using foldhash-f when we don't care about Hash DoS, e.g., when the data comes from the DB state and not from user input.
  3. ResistMap/Set -- using foldhash-q or some other hasher like siphash.

This could gain us some performance wins.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the current ahash-backed map and set definitions and reviewing how hashbrown uses foldhash. Compare the proposed IntMap/Set, FastMap/Set, and ResistMap/Set categories, including their security assumptions and performance tradeoffs. Done requires an agreed design and implementation scope; the issue does not name files or tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.