Skip to content

Instantly share code, notes, and snippets.

@yumed15
Last active November 21, 2023 16:12
Show Gist options
  • Save yumed15/59cb09a2ea10378780209638d35455a2 to your computer and use it in GitHub Desktop.
Save yumed15/59cb09a2ea10378780209638d35455a2 to your computer and use it in GitHub Desktop.
package main
import "github.com/pkg/profile"
type UserData struct {
ID int
Name string
}
func createObject() UserData {
user := UserData{ID: 1, Name: "John Doe"}
return user
}
func main() {
defer profile.Start(profile.TraceProfile, profile.ProfilePath(".")).Stop()
var user UserData
for i := 0; i < 1000000; i++ {
user = createObject()
_ = user
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment