[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Benchmark] Chain calls
- From: "Alexander Gladysh" <agladysh@...>
- Date: Sat, 15 Nov 2008 15:38:10 +0300
On Sat, Nov 15, 2008 at 3:09 PM, Alexander Gladysh <agladysh@gmail.com> wrote:
> On Sat, Nov 15, 2008 at 3:05 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> * Alexander Gladysh:
>> > I guess that the cost of returning function is compensated by proper tail
>> > recursion in the "chain" case, and that x1.09 slowdown of the "plain_chain"
>> > case is that cost itself.
>> I think you are probably measuring GETUPVAL performance.
> I think, that does not explain the difference between "plain_chain"
> and "plain" cases. I would, however, adjust my cases to cache function
> locally and post updated results here.
Or maybe I misunderstood you. Could you please elaborate a little?
Here are the results for the cached upvalue modification (code attached as chaincallbench.lua).
lua
-------------------------------------------------------------------
name | rel | abs s / iter = us (1e-6 s) / iter
-------------------------------------------------------------------
chain_upval | 1.0000 | 83.45 / 100000000 = 0.834500 us
plain_local | 1.0115 | 84.41 / 100000000 = 0.844100 us
plain_upval | 1.0260 | 85.62 / 100000000 = 0.856200 us
chain_local | 1.0405 | 86.83 / 100000000 = 0.868300 us
plain_chain_upval | 1.1081 | 92.47 / 100000000 = 0.924700 us
plain_chain_local | 1.1395 | 95.09 / 100000000 = 0.950900 us
luajit -O
-------------------------------------------------------------------
name | rel | abs s / iter = us (1e-6 s) / iter
-------------------------------------------------------------------
plain_local | 1.0000 | 10.35 / 100000000 = 0.103500 us
plain_upval | 1.1884 | 12.30 / 100000000 = 0.123000 us
plain_chain_local | 1.3652 | 14.13 / 100000000 = 0.141300 us
plain_chain_upval | 1.4541 | 15.05 / 100000000 = 0.150500 us
chain_upval | 1.5527 | 16.07 / 100000000 = 0.160700 us
chain_local | 1.5691 | 16.24 / 100000000 = 0.162400 us
The code to run benchmark is attached as kbench.tar.bz2. (It was slightly updated from the last time I posted.) Run it as
$ ./kbench.sh 'bench.lua chaincallbench.lua' 1e8 2>&1 | luajit -O kbenchparse.lua
Alexander.
Attachment:
chaincallbench.lua
Description: Binary data
Attachment:
kbench.tar.bz2
Description: BZip2 compressed data