https://github.com/orisano/intersect
https://github.com/orisano/intersect
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/orisano/intersect
- Owner: orisano
- License: apache-2.0
- Created: 2020-07-23T13:17:41.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-24T08:00:42.000Z (over 4 years ago)
- Last Synced: 2025-03-25T05:34:30.318Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# intersect

A library of intersect to sorted array. inspired by this article. https://lemire.me/blog/2019/01/16/faster-intersections-between-sorted-arrays-with-shotgun/
## Installation
```bash
go get github.com/orisano/intersect
```
## Benchmark
```
goos: darwin
goarch: amd64
pkg: github.com/orisano/intersect
BenchmarkIntersect/n=100000000,nTest=32,mMax=1000000000/Naive-8 10 107656768 ns/op
BenchmarkIntersect/n=100000000,nTest=32,mMax=1000000000/Galloping-8 797413 1477 ns/op
BenchmarkIntersect/n=100000000,nTest=32,mMax=1000000000/Shotgun1-8 1000000 1109 ns/op
BenchmarkIntersect/n=100000000,nTest=32,mMax=1000000000/Shotgun4-8 1671450 701 ns/op
BenchmarkIntersect/n=10000,nTest=7000,mMax=1000000000/Naive-8 21763 54934 ns/op
BenchmarkIntersect/n=10000,nTest=7000,mMax=1000000000/Galloping-8 26590 44635 ns/op
BenchmarkIntersect/n=10000,nTest=7000,mMax=1000000000/Shotgun1-8 8660 132265 ns/op
BenchmarkIntersect/n=10000,nTest=7000,mMax=1000000000/Shotgun4-8 8527 140649 ns/op
PASS
ok github.com/orisano/intersect 37.614s
```
## Author
Nao Yonashiro (@orisano)
## License
Apache 2.0