Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olliNiinivaara/StashTable
Concurrent hash table
https://github.com/olliNiinivaara/StashTable
Last synced: about 1 month ago
JSON representation
Concurrent hash table
- Host: GitHub
- URL: https://github.com/olliNiinivaara/StashTable
- Owner: olliNiinivaara
- License: mit
- Created: 2020-03-28T07:14:59.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-24T16:44:23.000Z (over 1 year ago)
- Last Synced: 2024-08-04T03:06:20.246Z (5 months ago)
- Language: Nim
- Homepage:
- Size: 257 KB
- Stars: 36
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nim - StashTable - Concurrent hash tables for Nim. (Data / Data Structures)
README
# StashTable
Concurrent hash table for Nim. Excellent way to safely share arbitrary data between multiple threads.## Example
```nim
# nim r example.nim
import os, random, stashtabletype SharedData = StashTable[string, seq[string], 100]
proc threading(d: tuple[t: int, shareddata: SharedData]) =
for i in 0 .. 10:
sleep(rand(10))
d.shareddata.withValue("somekey"): value[].add($d.t & "->" & $i)let shareddata = newStashTable[string, seq[string], 100]()
shareddata.insert("somekey", @[])var threads: array[2, Thread[tuple[t: int, shareddata: SharedData]]]
for i in 0 .. 1: createThread(threads[i], threading, (i, shareddata))
joinThreads(threads)
echo shareddata
```## Installation
latest stable release (1.2.2):
`atlas use StashTable`## Documentation
https://olliNiinivaara.github.io/StashTable/## Tests and benchmarking
https://github.com/olliNiinivaara/StashTable/blob/master/tests/testing.md