Advertisement
Guest User

Benchmarks between globals and locals.

a guest
Jan 4th, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.44 KB | None | 0 0
  1. local clock = os.clock()
  2.  
  3. for _ = 1, 10000 do
  4.     hello = true
  5.     hello2 = true
  6.     hello3 = true
  7.     hello4 = true
  8.     hello5 = true
  9.     hello6 = true
  10.     hello7 = true
  11. end
  12.  
  13. print(os.clock() - clock, "globals")
  14.  
  15. local clock2 = os.clock()
  16.  
  17. for _ = 1, 10000 do
  18.     local hello = true
  19.     local hello2 = true
  20.     local hello3 = true
  21.     local hello4 = true
  22.     local hello5 = true
  23.     local hello6 = true
  24.     local hello7 = true
  25. end
  26.  
  27. print(os.clock() - clock2, "local")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement