Skip to content

Latest commit

 

History

History
76 lines (66 loc) · 3.9 KB

README.md

File metadata and controls

76 lines (66 loc) · 3.9 KB

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.