View Single Post
08-21-14, 02:02 PM   #19
Sharparam
A Flamescale Wyrmkin
 
Sharparam's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2011
Posts: 102
With garbage collection disabled:

lua Code:
  1. collectgarbage("stop")
  2.  
  3. local clock = os.clock
  4.  
  5. local function func()
  6.     return 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9
  7. end
  8.  
  9. do
  10.     local time = clock()
  11.  
  12.     local q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l
  13.     for i = 1, 1e6 do
  14.         q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l = func()
  15.     end
  16.  
  17.     print(clock() - time, collectgarbage("count"))
  18. end
  19.  
  20. do
  21.     local time = clock()
  22.  
  23.     for i = 1, 1e6 do
  24.         local q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l = func()
  25.     end
  26.  
  27.     print(clock() - time, collectgarbage("count"))
  28. end
  29.  
  30. collectgarbage("restart")

Code:
(Run #1)
0.277   24.7861328125
0.157   24.8369140625

(Run #2)
0.285   24.7861328125
0.155   24.8369140625

(Run #3)
0.281   24.7861328125
0.16    24.8369140625

(Average)
0.281
0.15733333333333
  Reply With Quote