Commit Graph

5 Commits

Author SHA1 Message Date
Kirill Danshin ef10ed05a3 deprecate CoarseTime and replace it with a shortcut implementation
Signed-off-by: Kirill Danshin <k@guava.by>
2018-08-17 18:12:21 +03:00
Kirill Danshin 4c7269ec2a Revert "Remove CoarseTime"
This reverts commit f2ddaffc31.
2018-08-17 15:32:15 +03:00
Erik Dubbelboer f2ddaffc31 Remove CoarseTime
It is not clear why @valyala introduced this coarse time. Benchmarks on
different systems show that the speedup is no where enough to justify
the added code complexity and bugs it seems to have introduced.

Mac:
BenchmarkCoarseTimeNow-8   	2000000000	         2.49 ns/op
0 B/op	       0 allocs/op
BenchmarkTimeNow-8         	500000000	         3.14 ns/op
0 B/op	       0 allocs/op

Ubuntu:
BenchmarkCoarseTimeNow-4   	300000000	         6.74 ns/op
0 B/op	       0 allocs/op
BenchmarkTimeNow-4         	100000000	        15.9 ns/op
0 B/op	       0 allocs/op

This reverts commit https://github.com/erikdubbelboer/fasthttp/commit/6309f42188ecb28ccf8ac58442739cdb43d75d9e
and https://github.com/erikdubbelboer/fasthttp/commit/32c72cde80f0c591604f825586d6a4bbbb39d9c5.

See: https://github.com/valyala/fasthttp/issues/271,
https://github.com/valyala/fasthttp/pull/269 and
https://github.com/valyala/fasthttp/issues/261.
2018-08-17 17:15:41 +08:00
Aliaksandr Valialkin 32c72cde80 Export CoarseTimeNow and clarify that RequestCtx.Time() and RequestCtx.ConnTime() return time truncated to a second 2017-02-10 15:45:14 +02:00
Aliaksandr Valialkin 6309f42188 optimization: substitute time.Now() calls with coarse-grained time in hot paths 2017-02-09 23:59:06 +02:00