fastime is a super fast time function library for Go with zero memory allocation. fastime returns the approximate time.
Go 1.16
go get github.com/kpango/fastime
now := fastime.Now().StartTimerD(context.Background(), time.Millisecond*5)
defer fastime.Stop()
// Create Instance
ft := fastime.New().StartTimerD(context.Background(), time.Millisecond*5)
defer ft.Stop()
ft.Now()
go test -count=10 -run=NONE -bench . -benchmem
goos: linux
goarch: amd64
pkg: github.com/kpango/fastime
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.45 ns/op 0 B/op 0 allocs/op
BenchmarkFastime-8 2000000000 0.46 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1683 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1720 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1688 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1716 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1691 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1693 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1703 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1668 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1685 ns/op 0 B/op 0 allocs/op
BenchmarkTime-8 1000000 1716 ns/op 0 B/op 0 allocs/op
PASS
ok github.com/kpango/fastime 26.873s
- Fork it ( https://github.com/kpango/fastime/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
fastime released under MIT license, refer LICENSE file.