lua-users home
lua-l archive

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


Arrgh... Damn gmail and its reply to all feature...

2011/4/13 H. Diedrich <hd2010@eonblast.com>:
> Can I possibly see the benchmark code?

Here you are:

   local sformat, rnd, tostring, a =
       string.format, math.random, tostring, nil
   for i= 1,10000000 do
       a = sformat( "[%s]", tostring(rnd()) )
       -- a = "["..tostring(rnd).."]"
   end

As I told you earlier, I removed table.concat from the benchmark since
it was a constant factor, likely to dominate the benchmark. I added
tostring(rnd()), though to trigger string interning at each iteration,
but, now that I think of it, I could probably have used a constant
string... I was affraid that LuaJIT would do some magic and yank out
some constant code, but I didn't test this hypothesis...

-- Pierre-Yves