golang/go

time: optimize time.Time.Sub and time.Since

Open

#17,858 opened on Nov 8, 2016

View on GitHub
 (12 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
Performancehelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

According to a profiling data from a large number of servers at Google, time.Time.Sub is within the top 150 functions by CPU time. The current implementation of Sub is not inlineable. The logic for Sub is not particularly complicated and I believe it can be made to be inlined with some love.

Contributor guide