This is a creation in Article, where the information may have evolved or changed.
A few days ago, an example of GC tuning on an online Golang program introduced a sample that optimizes the GC for a particular program, from which you can see that go does not perform well when doing a GC for map (500,000 map, pause 8ms on i7-2600s)
Today is Sunday, the weather is good! Go out for a run in the afternoon, play in the morning at home program. The GO1.2RC5 package was downloaded from code.google.com, and the actual test of the situation has not changed.
The same program as the last one, the same machine:
gc32(1)(357463-354265) objects, 0(0) handoff, 0(0) steal, 0/0/0 yieldsgc33(1)(369735-366537) objects, 0(0) handoff, 0(0) steal, 0/0/0 yieldsgc34(1)(381720-378528) objects, 0(0) handoff, 0(0) steal, 0/0/0 yields
The GC time is reduced from the original 8ms to 2ms.
Gogctrace parameter is deprecated and replaced with Godebug
Search the code tree, cannot find the GOGCTRACE
typeface, now by the GODEBUG
environment variable take over. Specific code in SRC/PKG/RUNTIME/RUNTIME.C?NAME=GO1.2RC5#386:
Static struct { int8* name; Int32* value;} Dbgvar[] = { {"Gctrace", &Runtime·Debug.Gctrace}, {"Schedtrace", &Runtime·Debug.Schedtrace}, {"Scheddetail", &Runtime·Debug.Scheddetail},};
GOGCTRACE=1 go run gc.go # go1.2以前,GOGCTRACE环境变量控制 详细信息打印GODEBUG='gctrace=1' go run gc.go # go1.2rc5 由GODEBUG控制
Commit Retrospective
Curiosity about the reason for ascension, chasing after a while code.
The code for Go GC is concentrated in SRC/PKG/RUNTIME/MGC0.C.
# github 上,对golang code的镜像。相比于官方用hg管理,git对于我更友好一点git clone git@github.com:jnwhiteh/golang.git git log src/pkg/runtime/mgc0.c # 查看 src/pkg/runtime/mgc0.c 的修改记录
This increase in map GC performance could be the result of this commit of Keith Randall to the Issue 6119 fix, a commit message:
Runtime:record type information for hashtable internal structures. Remove All hashtable-specific GC code
A lot of memory data, causing the GC to pause for a long time, causing my headache. This is what I need to face daily: Load a lot of data, in a limited time (dozens of MS), online algorithm calculation, return results, such as recommendations, search and so on. This made me have to use C + + to complete the programming of the program. Delighted to see this progress. Map application very frequent data, this promotion, very meaningful. Look forward to the continued progress of the Go language GC!