{"action":"created","issue":{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/122","labels_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/122/labels{/name}","comments_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/122/comments","events_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/122/events","html_url":"https://github.com/LuaJIT/LuaJIT/issues/122","id":124924810,"number":122,"title":"bug of performance drop","user":{"login":"yongkangchen","id":704762,"avatar_url":"https://avatars.githubusercontent.com/u/704762?v=3","gravatar_id":"","url":"https://api.github.com/users/yongkangchen","html_url":"https://github.com/yongkangchen","followers_url":"https://api.github.com/users/yongkangchen/followers","following_url":"https://api.github.com/users/yongkangchen/following{/other_user}","gists_url":"https://api.github.com/users/yongkangchen/gists{/gist_id}","starred_url":"https://api.github.com/users/yongkangchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yongkangchen/subscriptions","organizations_url":"https://api.github.com/users/yongkangchen/orgs","repos_url":"https://api.github.com/users/yongkangchen/repos","events_url":"https://api.github.com/users/yongkangchen/events{/privacy}","received_events_url":"https://api.github.com/users/yongkangchen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2016-01-05T09:19:08Z","updated_at":"2016-01-07T03:07:13Z","closed_at":null,"body":"There are two tests, the only difference is the execute order, but get the different performance.\r\n### Code of normal result:\r\n```\r\nrequire \"vector3\"\r\ncollectgarbage()\r\ntest3() -- output: test3/lua 0.000874\r\ncollectgarbage()\r\ntest2() -- output: test2/lua 0.063899\r\n```\r\n\r\n###  Code of bad result:\r\n```\r\nrequire \"vector3\"\r\ncollectgarbage()\r\ntest2() -- output: test2/lua 0.058866\r\ncollectgarbage()\r\ntest3() -- output: test3/lua 0.253925\r\n```\r\n\r\n#####  Code of vector3:\r\n```\r\nlocal Vector3 = { __typename = 'Vector3' }\r\ndo\r\n        local setmetatable = setmetatable\r\n        local I = { __typename='Vector3' }\r\n\r\n        Vector3.__call = function(t, x, y, z)\r\n                return setmetatable({x or 0, y or 0, z or 0}, I)\r\n        end\r\n        setmetatable(Vector3, Vector3)\r\nend\r\n\r\nfunction test2()\r\n        local start = os.clock()\r\n        for i = 1,200000 do\r\n                local up = Vector3(0,1,0)\r\n                tostring(up)\r\n        end\r\n        print(\"test2/lua \" .. (os.clock() - start));\r\nend\r\n\r\nfunction test3()\r\n        local start = os.clock()\r\n        for i = 1, 2000000 do\r\n                Vector3(i, i, i)\r\n        end\r\n        print(\"test3/lua \" .. (os.clock() - start));\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/comments/169535473","html_url":"https://github.com/LuaJIT/LuaJIT/issues/122#issuecomment-169535473","issue_url":"https://api.github.com/repos/LuaJIT/LuaJIT/issues/122","id":169535473,"user":{"login":"yongkangchen","id":704762,"avatar_url":"https://avatars.githubusercontent.com/u/704762?v=3","gravatar_id":"","url":"https://api.github.com/users/yongkangchen","html_url":"https://github.com/yongkangchen","followers_url":"https://api.github.com/users/yongkangchen/followers","following_url":"https://api.github.com/users/yongkangchen/following{/other_user}","gists_url":"https://api.github.com/users/yongkangchen/gists{/gist_id}","starred_url":"https://api.github.com/users/yongkangchen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yongkangchen/subscriptions","organizations_url":"https://api.github.com/users/yongkangchen/orgs","repos_url":"https://api.github.com/users/yongkangchen/repos","events_url":"https://api.github.com/users/yongkangchen/events{/privacy}","received_events_url":"https://api.github.com/users/yongkangchen/received_events","type":"User","site_admin":false},"created_at":"2016-01-07T03:07:13Z","updated_at":"2016-01-07T03:07:13Z","body":"If so, can you explain why? :)"}}