lua-users home
lua-l archive

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


>> 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"?

Oops. Bad search-and-replace. Sorry. Should be "empty_string".

Fixed benchmark along with new output analyzer is attached. Run as:

$ KBENCH_SCRIPT=estrbench.lua KBENCH_NUM_ITER=1000000000 ./kbench.sh 2>&1 | lua kbenchparse.lua

Analyzer output for another benchmark run with relative numbers (may be corrupted by mailer, so I had to use HTML letter, sorry):

lua
----------------------------------------------------------------------------
                name |     rel |   delta | abs / iter = ns per iteration
----------------------------------------------------------------------------
                noop |  1.0000 |  0.0000 | 107.49 / 1000000000 = 0.107490 ns
   nonempty_constant |  1.1480 | 15.9100 | 123.40 / 1000000000 = 0.123400 ns
      empty_constant |  1.2079 | 22.3500 | 129.84 / 1000000000 = 0.129840 ns
    nonempty_upvalue |  1.2148 | 23.0900 | 130.58 / 1000000000 = 0.130580 ns
       empty_upvalue |  1.2777 | 29.8500 | 137.34 / 1000000000 = 0.137340 ns
       nonempty_size |  1.2886 | 31.0200 | 138.51 / 1000000000 = 0.138510 ns
          empty_size |  1.3300 | 35.4700 | 142.96 / 1000000000 = 0.142960 ns
luajit -O
----------------------------------------------------------------------------
                name |     rel |   delta | abs / iter = ns per iteration
----------------------------------------------------------------------------
                noop |  1.0000 |  0.0000 |  14.19 / 1000000000 = 0.014190 ns
   nonempty_constant |  1.2551 |  3.6200 |  17.81 / 1000000000 = 0.017810 ns
      empty_constant |  1.2699 |  3.8300 |  18.02 / 1000000000 = 0.018020 ns
       nonempty_size |  1.8189 | 11.6200 |  25.81 / 1000000000 = 0.025810 ns
          empty_size |  1.8428 | 11.9600 |  26.15 / 1000000000 = 0.026150 ns
    nonempty_upvalue |  1.8915 | 12.6500 |  26.84 / 1000000000 = 0.026840 ns
       empty_upvalue |  1.8922 | 12.6600 |  26.85 / 1000000000 = 0.026850 ns


Alexander.

Attachment: estrbench.lua
Description: Binary data

Attachment: kbench.sh
Description: Bourne shell script

Attachment: kbenchparse.lua
Description: Binary data