aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/timeasm.go
AgeCommit message (Collapse)Author
2021-04-29runtime: implement time.now in assembly for linux-amd64Ian Lance Taylor
name old time/op new time/op delta AfterFunc-12 66.7µs ± 3% 66.8µs ± 4% ~ (p=0.836 n=20+20) After-12 99.4µs ± 4% 98.1µs ± 3% -1.31% (p=0.013 n=20+20) Stop-12 66.1µs ±12% 65.4µs ±10% ~ (p=0.602 n=20+20) SimultaneousAfterFunc-12 110µs ± 1% 114µs ± 2% +3.98% (p=0.000 n=19+18) StartStop-12 32.1µs ±15% 32.2µs ±13% ~ (p=0.620 n=20+20) Reset-12 3.66µs ± 2% 3.63µs ± 5% -0.92% (p=0.018 n=20+17) Sleep-12 134µs ± 1% 139µs ± 4% +3.97% (p=0.000 n=20+18) Ticker-12 32.8µs ± 1% 32.6µs ± 2% -0.63% (p=0.017 n=18+20) TickerReset-12 3.72µs ± 3% 3.71µs ± 3% ~ (p=0.753 n=20+20) TickerResetNaive-12 68.9µs ±11% 65.8µs ± 8% -4.44% (p=0.008 n=20+20) Now-12 33.3ns ± 1% 29.6ns ± 0% -11.06% (p=0.000 n=18+16) NowUnixNano-12 34.6ns ± 0% 31.2ns ± 0% -9.94% (p=0.000 n=20+17) NowUnixMilli-12 35.0ns ± 1% 30.9ns ± 0% -11.75% (p=0.000 n=19+15) NowUnixMicro-12 35.0ns ± 0% 30.9ns ± 0% -11.85% (p=0.000 n=20+19) Format-12 302ns ± 3% 306ns ± 3% +1.22% (p=0.009 n=20+20) FormatNow-12 184ns ± 5% 187ns ± 2% +1.25% (p=0.046 n=20+19) MarshalJSON-12 262ns ± 2% 270ns ± 3% +2.99% (p=0.000 n=20+20) MarshalText-12 262ns ± 3% 268ns ± 3% +2.37% (p=0.000 n=19+19) Parse-12 145ns ± 1% 148ns ± 0% +2.27% (p=0.000 n=18+19) ParseDuration-12 82.3ns ± 1% 79.7ns ± 1% -3.06% (p=0.000 n=20+20) Hour-12 4.48ns ± 1% 4.42ns ± 1% -1.32% (p=0.000 n=19+19) Second-12 4.44ns ± 1% 4.42ns ± 1% -0.39% (p=0.000 n=20+18) Year-12 11.2ns ± 1% 11.1ns ± 1% ~ (p=0.193 n=20+20) Day-12 14.8ns ± 0% 14.8ns ± 1% ~ (p=0.873 n=19+20) ISOWeek-12 17.2ns ± 0% 17.2ns ± 0% ~ (p=0.605 n=18+20) name old avg-late-ns new avg-late-ns delta ParallelTimerLatency-12 375k ± 3% 377k ± 3% ~ (p=0.445 n=20+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-12 136k ± 2% 137k ± 2% ~ (p=0.242 n=20+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-12 97.4k ±11% 96.4k ±10% ~ (p=0.336 n=19+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-12 74.8k ± 3% 74.2k ± 3% ~ (p=0.158 n=20+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-12 70.7k ± 7% 70.4k ± 6% ~ (p=0.879 n=20+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-12 65.8k ± 9% 66.3k ±14% ~ (p=0.594 n=17+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-12 55.5k ±29% 56.7k ±30% ~ (p=0.758 n=20+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-12 45.3k ±29% 43.6k ±33% ~ (p=0.212 n=19+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-12 64.7k ±46% 65.2k ±78% ~ (p=0.480 n=18+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-12 147k ±88% 119k ±83% ~ (p=0.092 n=19+18) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-12 2.63M ±29% 2.70M ±59% ~ (p=0.989 n=19+20) StaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-12 81.4k ± 4% 80.2k ± 3% -1.55% (p=0.009 n=17+18) name old max-late-ns new max-late-ns delta ParallelTimerLatency-12 7.66M ±102% 6.98M ±131% ~ (p=0.445 n=20+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=1-12 381k ±12% 382k ±17% ~ (p=0.901 n=17+16) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=2-12 388k ±69% 356k ±10% ~ (p=0.363 n=17+16) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=3-12 350k ±17% 347k ±25% ~ (p=0.538 n=19+18) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=4-12 378k ±52% 341k ±30% ~ (p=0.153 n=18+17) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=5-12 392k ±54% 410k ±78% ~ (p=0.730 n=18+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=6-12 467k ±80% 527k ±129% ~ (p=0.616 n=17+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=7-12 915k ±138% 1023k ±227% ~ (p=0.696 n=20+18) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=8-12 1.84M ±155% 1.74M ±158% ~ (p=0.893 n=18+19) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=9-12 6.95M ±92% 7.66M ±91% ~ (p=0.687 n=19+20) StaggeredTickerLatency/work-dur=300µs/tickers-per-P=10-12 18.6M ±22% 16.2M ±28% -12.78% (p=0.003 n=19+19) StaggeredTickerLatency/work-dur=2ms/tickers-per-P=1-12 1.01M ± 8% 1.04M ±10% ~ (p=0.111 n=19+18) Change-Id: I96aa2e0206a6e9286bcbfc8be372e84608ed4e2f Reviewed-on: https://go-review.googlesource.com/c/go/+/314277 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-04-28runtime: use a single definition of time_now for faketimeIan Lance Taylor
Build other definitions with the !faketime build tag. This makes it easy for us to add new assembly implementations of time.now. Change-Id: I4e48e41a4a04ab001030e6d1cdd9cebfa0161b0d Reviewed-on: https://go-review.googlesource.com/c/go/+/314274 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-02runtime, time: refactor startNano handlingDmitry Vyukov
Move startNano from runtime to time package. In preparation for a subsequent change that speeds up Since and Until. This also makes code simpler as we have less assembly as the result, monotonic time handling is better localized in time package. This changes values returned from nanotime on windows (it does not account for startNano anymore), current comments state that it's important, but it's unclear how it can be important since no other OS does this. Update #25729 Change-Id: I2275d57b7b5ed8fd0d53eb0f19d55a86136cc555 Reviewed-on: https://go-review.googlesource.com/c/146340 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-05-29runtime: implement time.now using libcKeith Randall
Change-Id: Ibdd9202d9711ea8aab2446c9950ddb8e1f6bf4e0 Reviewed-on: https://go-review.googlesource.com/114799 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-02-09time: optimize Now on darwin, windowsRuss Cox
Fetch both monotonic and wall time together when possible. Avoids skew and is cheaper. Also shave a few ns off in conversion in package time. Compared to current implementation (after monotonic changes): name old time/op new time/op delta Now 19.6ns ± 1% 9.7ns ± 1% -50.63% (p=0.000 n=41+49) darwin/amd64 Now 23.5ns ± 4% 10.6ns ± 5% -54.61% (p=0.000 n=30+28) windows/amd64 Now 54.5ns ± 5% 29.8ns ± 9% -45.40% (p=0.000 n=27+29) windows/386 More importantly, compared to Go 1.8: name old time/op new time/op delta Now 9.5ns ± 1% 9.7ns ± 1% +1.94% (p=0.000 n=41+49) darwin/amd64 Now 12.9ns ± 5% 10.6ns ± 5% -17.73% (p=0.000 n=30+28) windows/amd64 Now 15.3ns ± 5% 29.8ns ± 9% +94.36% (p=0.000 n=30+29) windows/386 This brings time.Now back in line with Go 1.8 on darwin/amd64 and windows/amd64. It's not obvious why windows/386 is still noticeably worse than Go 1.8, but it's better than before this CL. The windows/386 speed is not too important; the changes just keep the two architectures similar. Change-Id: If69b94970c8a1a57910a371ee91e0d4e82e46c5d Reviewed-on: https://go-review.googlesource.com/36428 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>