Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t1 := time.Now()
- var s []string
- for x:=0;x<10000000;x++ {
- s = append(s, "HELLO")
- }
- fmt.Println(time.Now().Sub(t1)) // AVG 700ms
- s = []string{}
- t1 = time.Now()
- s2 := make([]string, 0, 10000000)
- for x:=0;x<10000000;x++ {
- s2 = append(s2, "HELLO")
- }
- fmt.Println(time.Now().Sub(t1)) // AVG 150ms
Add Comment
Please, Sign In to add comment