Reference:
Lock Laptop CPU performance (linux only) to avoid throttling.
https://github.com/aclements/perflock
High Performance Go Workshop
https://dave.cheney.net/high-performance-go-workshop/gopherchina-2019.html
cmd/compile
https://golang.org/pkg/cmd/compile/
go build -gcflags doc
https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/compile.go
SSA:
https://godoc.org/golang.org/x/tools/go/ssa
Which function is inlined or not/heap alloc or not:
$ go build -gcflags='-m -m' *.go
$ go build -gcflags=-d=ssa/check_bce/debug=1 *.go
Prove path (SSA aka. Static Single-Assignment):
$ go build -gcflags=-d=ssa/prove/debug=1 *.go
$ go build -gcflags=-d=ssa/prove/debug=2 *.go
code snippet:
internally, string as key of a map internally converted to []byte:
Lock Laptop CPU performance (linux only) to avoid throttling.
https://github.com/aclements/perflock
High Performance Go Workshop
https://dave.cheney.net/high-performance-go-workshop/gopherchina-2019.html
cmd/compile
https://golang.org/pkg/cmd/compile/
go build -gcflags doc
https://github.com/golang/go/blob/master/src/cmd/compile/internal/ssa/compile.go
SSA:
https://godoc.org/golang.org/x/tools/go/ssa
Which function is inlined or not/heap alloc or not:
$ go build -gcflags='-m -m' *.go
$ go build -gcflags=-d=ssa/check_bce/debug=1 *.go
Prove path (SSA aka. Static Single-Assignment):
$ go build -gcflags=-d=ssa/prove/debug=1 *.go
$ go build -gcflags=-d=ssa/prove/debug=2 *.go
code snippet:
internally, string as key of a map internally converted to []byte:
m = make(map[string]string) # clear it, it's fast after Go v1.11 for k := range m { delete(m, k) }
Count string size::
n := len([]rune(str))
Tooling, dump SSA to ssa.html
$ GOSSAFUNC=FuncName go build && open ssa.html
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.