Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kpango/fastime
Blazing fast time function library for Go with zero memory allocation. fastime returns the approximate time.
https://github.com/kpango/fastime
fast golang lock-free time zero-allocation
Last synced: 2 months ago
JSON representation
Blazing fast time function library for Go with zero memory allocation. fastime returns the approximate time.
- Host: GitHub
- URL: https://github.com/kpango/fastime
- Owner: kpango
- License: mit
- Created: 2018-09-18T08:17:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-22T12:11:20.000Z (almost 2 years ago)
- Last Synced: 2024-12-10T19:15:31.410Z (2 months ago)
- Topics: fast, golang, lock-free, time, zero-allocation
- Language: Go
- Homepage:
- Size: 448 KB
- Stars: 53
- Watchers: 6
- Forks: 15
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - fastime - Blazing fast time function library for Go with zero memory allocation. fastime returns the approximate time. (Go)
README
![]()
[](https://opensource.org/licenses/MIT)
[](https://github.com/kpango/fastime/releases/latest)
[](https://circleci.com/gh/kpango/fastime)
[](https://codecov.io/gh/kpango/fastime)
[](https://www.codacy.com/app/i.can.feel.gravity/fastime?utm_source=github.com&utm_medium=referral&utm_content=kpango/fastime&utm_campaign=Badge_Grade)
[](https://goreportcard.com/report/github.com/kpango/fastime)
[](http://godoc.org/github.com/kpango/fastime)
[](https://gitter.im/kpango/fastime?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
fastime is a super fast time function library for Go with zero memory allocation. fastime returns the approximate time.## Requirement
Go 1.16## Installation
```shell
go get github.com/kpango/fastime
```## Example
```go
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](https://github.com/kpango)## LICENSE
fastime released under MIT license, refer [LICENSE](https://github.com/kpango/fastime/blob/master/LICENSE) file.