Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vedranvuk/container
Various containers and datastructures.
https://github.com/vedranvuk/container
datastructures fifo golang queue
Last synced: 25 days ago
JSON representation
Various containers and datastructures.
- Host: GitHub
- URL: https://github.com/vedranvuk/container
- Owner: vedranvuk
- License: mit
- Created: 2020-04-14T12:28:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T13:07:56.000Z (over 4 years ago)
- Last Synced: 2024-06-20T12:06:08.220Z (7 months ago)
- Topics: datastructures, fifo, golang, queue
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# container
WARNING: Work in progress. APIs might change but tags will be added to discern versions if it does. If using in production, please use vendoring or repackage into your own package.
## Description
Various containers and datastructures.
* queue
* fifo: First-In-First-Out queue.
* ttl: Timeout list of items with Time To Live.## fifo
A singly linked concurency safe first in first out list with Push, Pop, Peek and Remove operations.
## ttl
A doubly linked concurency safe list with item specific timeouts using an additional map for fast item access. Insert positions sorted by item timeout timestamps are done starting from end of list by default from presumption list will serve for session tracking with all sessions having same timeouts.
## Benchmarks
### fifo
An i5 skylake lap with 8GB RAM.
```
pkg: github.com/vedranvuk/container/queue/fifo
BenchmarkQueuePush
BenchmarkQueuePush-4 7219392 185 ns/op
BenchmarkQueuePop
BenchmarkQueuePop-4 55198738 20.5 ns/op
BenchmarkQueuePeek
BenchmarkQueuePeek-4 64719546 18.5 ns/op
BenchmarkQueueRemoveFirst
BenchmarkQueueRemoveFirst-4 3925570 310 ns/op
BenchmarkQueueRemoveLast
BenchmarkQueueRemoveLast-4 49438 117964 ns/op
BenchmarkQueueRemoveRandom
BenchmarkQueueRemoveRandom-4 84730 130831 ns/op
```### ttl
Average times with 0 .. 1s random timeouts.
```
pkg: github.com/vedranvuk/container/queue/ttl
BenchmarkTTLAdd
BenchmarkTTLAdd-4 2275051 523 ns/op
BenchmarkTTLRemove
BenchmarkTTLRemove-4 8822643 119 ns/op
BenchmarkTTLRemoveReverse
BenchmarkTTLRemoveReverse-4 34743085 29.8 ns/op
BenchmarkTTLReset
BenchmarkTTLReset-4 6620694 155 ns/op
BenchmarkTTLResetReverse
BenchmarkTTLResetReverse-4 6337597 182 ns/op
```## License
MIT. See incliuded LICENSE file.