Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mralias/reservoir-sampling
Comparison of reservoir sampling algorithms
https://github.com/mralias/reservoir-sampling
Last synced: about 2 months ago
JSON representation
Comparison of reservoir sampling algorithms
- Host: GitHub
- URL: https://github.com/mralias/reservoir-sampling
- Owner: MrAlias
- License: apache-2.0
- Created: 2023-07-28T21:31:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-18T14:39:11.000Z (over 1 year ago)
- Last Synced: 2024-10-18T11:27:44.759Z (3 months ago)
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reservoir Sampling Algorithms
Comparison of reservoir sampling algorithms.
## Results
```sh
go test -run='^$' -bench=. -count=10 > results.txt && benchstat results.txt
``````
goos: linux
goarch: amd64
pkg: github.com/MrAlias/reservoir-sampling
cpu: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
│ results.txt │
│ sec/op │
RNG/Int63-8 3.347n ± 2%
RNG/Float64-8 3.923n ± 5%
Sampler/R-8 22.08n ± 2%
Sampler/L-8 2.312n ± 5%
Sampler/X-8 3.338n ± 7%
Sampler/Z-8 2.372n ± 8%
geomean 4.176n
```## References
- [Reservoir Sampling Wiki](https://en.wikipedia.org/wiki/Reservoir_sampling)
- [Vitter, Jeffrey S. (1 March 1985). "Random sampling with a reservoir"](http://www.cs.umd.edu/~samir/498/vitter.pdf)
- [Java implementation version](https://richardstartin.github.io/posts/reservoir-sampling)