Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Update README.md #2

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
# swiss
Golang port of Abseil's flat_hash_map
# SwissMap

SwissMap is a hash table adapated from the "SwissTable" family of hash tables from [Abseil](https://abseil.io/blog/20180927-swisstables). It uses [AES](https://github.com/dolthub/maphash) instructions for fast-hashing and performs key lookups in parallel using [SSE](https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions) instructions. Because of these optimizations, SwissMap is faster and more memory efficient than Golang's built-in `map`. If you'd like to learn more about its design and implementation, check out this [blog post](https://www.dolthub.com/blog/2023-03-28-swiss-map/) announcing its release.


## Example

SwissMap exposes the same interface as the built-in `map`. Give it a try using this [Go playground]().

```go
package main

import "github.com/dolthub/swiss"

func main() {
m := swiss.NewMap[string, int](42)

m.Put("foo", 1)
m.Put("bar", 2)

if x, ok := m.Get("foo"); ok {
println(x)
}
if m.Has("bar") {
x, _ := m.Get("bar")
println(x)
}

m.Put("foo", -1)
m.Delete("bar")

if x, ok := m.Get("foo"); ok {
println(x)
}
if m.Has("bar") {
x, _ := m.Get("bar")
println(x)
}
}
```
```
1
2
-1

Program exited.
```