-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Needed changes to improve performance (At least in theory):
- Change
timers []*timer
totimers []timerBucket
- Make new timerBucket struct as
type timerBucket struct {
timer *timer
// Two reason to have timer when here:
// - hot cache to prevent dereference timer to get when field
// - It can be difference with timer when filed in timerModifiedXX status.
when int64
}
- Delete
when int64
from timer struct in favor oftimerBucket
when field. - Rename
nextwhen int64
towhen int64
in timer struct - Make some few other changes to respect above changes in related functions
By this changes, we claim that we improve performance in siftupTimer
and siftdownTimer
when need to compare timers added when to timing heap, we don't need to get data from many different location in the memory (dereference many timers) and we have timers added when in sequential array.
Additional suggestions to improve code readability:
- make
timer.go
andtimers.go
in runtime package - make timers struct
- move timers field from p struct in runtime2.go to timers struct and embed this struct instead
- move all timers logic from many files in runtime package to timers.go such as logics in
time.go - almost everthing
,proc.go - checkTimers
, ...
p.s: If the idea is ok, I can help to make changes by send a PR.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Type
Projects
Status
Done