mirror of
https://github.com/americanexpress/baton.git
synced 2025-03-30 15:08:27 +00:00
Avoid doing the division in the hot path
This commit is contained in:
parent
06a5b867fa
commit
a16f6402bf
@ -64,7 +64,7 @@ func (worker *worker) performRequest(req *fasthttp.Request, resp *fasthttp.Respo
|
||||
}
|
||||
timeAfter := time.Now().UnixNano()
|
||||
|
||||
i := int((timeAfter - timeNow) / 1000)
|
||||
i := int(timeAfter - timeNow)
|
||||
// The select is needed to avoid blocking the thread
|
||||
// if the channel is full
|
||||
select {
|
||||
@ -120,6 +120,7 @@ func (worker *worker) collectStatistics() {
|
||||
sum, total := int64(0), 0
|
||||
|
||||
for timing := range worker.timings {
|
||||
timing = timing / 1000
|
||||
// The first request is associated with overhead
|
||||
// in setting up the client so we ignore it's result
|
||||
if first {
|
||||
|
Loading…
x
Reference in New Issue
Block a user