Skip to content

Instantly share code, notes, and snippets.

@perjerz
Last active June 9, 2018 07:38
Show Gist options
  • Save perjerz/0a671fa0d710f1b795d3a8a52bf5681e to your computer and use it in GitHub Desktop.
Save perjerz/0a671fa0d710f1b795d3a8a52bf5681e to your computer and use it in GitHub Desktop.
UltimateGo
package main
import "fmt"
type user struct {
name string
email string
}
func main() {
u1 := createUser1()
fmt.Println(u1)
}
//go:noinline
func createUser1() *user {
u1 := user{
name: "Hello",
email: "perjerz3434@gmail",
}
return &u1
}
//composit ltereal
//// Share อยู่บน
//var u *user
//err := son.Unmarshal([]byte(r), u)
//return u, err
//
//// Share อยู่ล่าง Share กับ call
//var v user
//err2 := json.Unmarshal([]byte(r), &v)
//return v, err
//go build -gcflags "-m -m -m" -m -> ความลึก ตัวเดียวก็ได้
// composit literal &x{ p: 1}
// go test -gcflags "-m -m" -run none -bench . -benchmem -memprofile mem.out
// go tool pprof -alloc_space mem.out
// https://github.com/ardanlabs/gotraining/tree/master/topics/go/profiling
// https://artem.krylysov.com/blog/
// https://github.com/dvyukov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment