Guest User

Untitled

a guest
Dec 12th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1.  
  2. t1 := time.Now()
  3. var s []string
  4. for x:=0;x<10000000;x++ {
  5. s = append(s, "HELLO")
  6. }
  7. fmt.Println(time.Now().Sub(t1)) // AVG 700ms
  8.  
  9. s = []string{}
  10. t1 = time.Now()
  11. s2 := make([]string, 0, 10000000)
  12. for x:=0;x<10000000;x++ {
  13. s2 = append(s2, "HELLO")
  14. }
  15. fmt.Println(time.Now().Sub(t1)) // AVG 150ms
Add Comment
Please, Sign In to add comment