refactor!: shorter constructors, bucketsubtable #22

Merged
mvhutz merged 6 commits from refactor/name-bucket-slot-table into main 2026-04-16 03:15:39 +00:00
Owner

Description

Currently, the name of bucket is a bit confusing, because it is considered a 'table' in literature (as well as the whole hash table). A bucket is better described as a 'subtable', which is used by the total hash table to perform cuckoo hashing.

In addition, the constructors NewTable, NewTableBy, and NewCustomTable were given shorter names, because the package name cuckoo already implies that New* would create a hash table with cuckoo hashing. This package has one use-case, and so it unambiguous what constructors produce.

Changes

  • NewTable -> New
  • NewTableBy -> NewBy
  • NewCustomTable -> NewCustom
  • bucket -> subtable

Design Decisions

  • I would have renamed Table and subtable to map equivalents, but 'submap' implies that a certain subsection of the map is contained within it, which isn't quite right.
  • I chose not to go with Map and table, because of the split naming convention.

Checklist

  • Tests pass
  • Docs updated
## Description Currently, the name of `bucket` is a bit confusing, because it is considered a 'table' in literature (as well as the whole hash table). A `bucket` is better described as a 'subtable', which is used by the total hash table to perform cuckoo hashing. In addition, the constructors `NewTable`, `NewTableBy`, and `NewCustomTable` were given shorter names, because the package name `cuckoo` already implies that `New*` would create a hash table with cuckoo hashing. This package has one use-case, and so it unambiguous what constructors produce. ## Changes - `NewTable` -> `New` - `NewTableBy` -> `NewBy` - `NewCustomTable` -> `NewCustom` - `bucket` -> `subtable` ### Design Decisions - I would have renamed `Table` and `subtable` to map equivalents, but 'submap' implies that a certain subsection of the map is contained within it, which isn't quite right. - I chose not to go with `Map` and `table`, because of the split naming convention. ## Checklist - [x] Tests pass - [x] Docs updated
mvhutz added 5 commits 2026-04-14 01:21:38 +00:00
- NewCustomTable -> NewCustom
- NewTableBy -> NewBy
- NewTable -> New
- Removed instances of `growthFactor`, as it is unexported.
- Typo in `HashTable.String()`.
refactor: HashTable -> Table, table -> subtable
All checks were successful
CI / Check PR Title (pull_request) Successful in 29s
CI / Go Lint (pull_request) Successful in 39s
CI / Makefile Lint (pull_request) Successful in 48s
CI / Markdown Lint (pull_request) Successful in 31s
CI / Unit Tests (pull_request) Successful in 37s
CI / Fuzz Tests (pull_request) Successful in 1m38s
CI / Mutation Tests (pull_request) Successful in 1m19s
5c39182958
mvhutz added 1 commit 2026-04-16 03:13:22 +00:00
Merge remote-tracking branch 'origin' into refactor/name-bucket-slot-table
All checks were successful
CI / Check PR Title (pull_request) Successful in 30s
CI / Go Lint (pull_request) Successful in 48s
CI / Markdown Lint (pull_request) Successful in 34s
CI / Makefile Lint (pull_request) Successful in 49s
CI / Unit Tests (pull_request) Successful in 48s
CI / Fuzz Tests (pull_request) Successful in 1m17s
CI / Mutation Tests (pull_request) Successful in 1m23s
a97aafca75
mvhutz merged commit 7cc1657403 into main 2026-04-16 03:15:39 +00:00
mvhutz deleted branch refactor/name-bucket-slot-table 2026-04-16 03:15:40 +00:00
Sign in to join this conversation.