Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/phuslu/goid
fastest goid
https://github.com/phuslu/goid
Last synced: 1 day ago
JSON representation
fastest goid
- Host: GitHub
- URL: https://github.com/phuslu/goid
- Owner: phuslu
- License: mit
- Created: 2022-08-11T03:44:23.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-06T13:15:25.000Z (6 months ago)
- Last Synced: 2024-08-04T04:04:13.434Z (4 months ago)
- Language: Go
- Homepage: https://pkg.go.dev/github.com/phuslu/goid
- Size: 6.84 KB
- Stars: 10
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Getting Started
An out of box example. [![playground][play-simple-img]][play-simple]
```go
package mainimport (
"github.com/phuslu/goid"
)func main() {
println(goid.Goid())
}// Output:
// 1
```### Performance
```go
// go test -v -cpu=1 -run=none -bench=. -benchtime=10s -benchmem bench_test.go
package mainimport (
"testing"choleraehyq "github.com/choleraehyq/pid"
petermattis "github.com/petermattis/goid"
phuslu "github.com/phuslu/goid"
)func BenchmarkCholeraehyq(b *testing.B) {
for i := 0; i < b.N; i++ {
choleraehyq.Get()
}
}func BenchmarkPetermattis(b *testing.B) {
for i := 0; i < b.N; i++ {
petermattis.Get()
}
}func BenchmarkPhuslu(b *testing.B) {
for i := 0; i < b.N; i++ {
phuslu.Goid()
}
}
```A Performance result as below, for daily benchmark results see [github actions][benchmark]
```
goos: linux
goarch: amd64
pkg: bench
cpu: AMD EPYC 7763 64-Core Processor
BenchmarkCholeraehyq
BenchmarkCholeraehyq 1000000000 1.866 ns/op 0 B/op 0 allocs/op
BenchmarkPetermattis
BenchmarkPetermattis 1000000000 1.858 ns/op 0 B/op 0 allocs/op
BenchmarkPhuslu
BenchmarkPhuslu 1000000000 1.858 ns/op 0 B/op 0 allocs/op
PASS
ok bench 6.151s
```[play-simple-img]: https://img.shields.io/badge/playground-VNOBbotvDd6-29BEB0?style=flat&logo=go
[play-simple]: https://go.dev/play/p/VNOBbotvDd6
[benchmark]: https://github.com/phuslu/goid/actions?query=workflow%3Abenchmark