lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Alexander Gladysh wrote:
On Tue, Aug 26, 2008 at 6:17 AM, KHMan <keinhong@gmail.com> wrote:
Alexander Gladysh wrote:
[snip]
for count = 1, math.huge do
  local line = io.read()
  if line == "" then break end
  io.write(string.format("%6d ", count), line, "\n")
end
[snip]
You're right, I've forgot to include noop function in tests list. Here
are the updated timings:

$ time lua estrbench.lua empty_upvalue 1000000000
      142.28 real       133.89 user         0.90 sys
$ time lua estrbench.lua nonempty_upvalue 1000000000
      174.01 real       163.54 user         1.18 sys

These should be similar, since both involve an upvalue load and a compare of the same type of object.

local nonempty_upvalue = function()
  local a = "nonempty"
  return a == nonempty_string
end

Was the script doing a table lookup for "nonempty_string"?

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia