Last active
November 21, 2023 16:12
-
-
Save yumed15/59cb09a2ea10378780209638d35455a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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