by mikemike · 10y ago · 0 comments
local t = setmetatable({}, {
__index = pcall, __newindex = rawset,
__call = function(t, i) t[i] = 42 end,
})
for i=1,100 do assert(t[i] == true and rawget(t, i) == 42) end
[LuaJIT has no problems with this code and turns it into 8 machine code instructions for the actual loop.]Anyway ...
This permanent excuse of JavaScript proponents that it has more complex semantics, which somehow prevents it from being made fast, is getting old. There are no insurmountable obstacles to make JavaScript fast -- it just takes more effort!
And they dug this hole themselves, by not cleaning up the language and allowing new complicated features into the language. Well ...
No comments yet.