Thread: local _G = _G
View Single Post
12-10-10, 03:21 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Code:
local _G = _G 
function test()
    local start = time()
    for x = 1, 200000000 do
        local a = _G["TargetFrame"]
        
    end
    print(time() - start)
end
Result: 8

Code:
function test()
    local start = time()
    for x = 1, 200000000 do
        local a = _G["TargetFrame"]
        
    end
    print(time() - start)
end
Result: 10

But can't say why.

[edit]
Keep in mind that are 200,000,000 loops. In words: two hundred million. The difference is ~2 secs. 0.00000001 secs per access.
Guess it's save to ignore that in most cases.

Last edited by Duugu : 12-10-10 at 03:26 PM.
  Reply With Quote