Skip to content
/ fastime Public

Blazing fast time function library for Go with zero memory allocation. fastime returns the approximate time.

License

Notifications You must be signed in to change notification settings

kpango/fastime

Repository files navigation

License: MIT release CircleCI codecov Codacy Badge Go Report Card GoDoc Join the chat at https://gitter.im/kpango/fastime fastime is a super fast time function library for Go with zero memory allocation. fastime returns the approximate time.

Requirement

Go 1.16

Installation

go get github.com/kpango/fastime

Example

    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()

Benchmark

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

Contribution

  1. Fork it ( https://github.com/kpango/fastime/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Author

kpango

LICENSE

fastime released under MIT license, refer LICENSE file.