lua-users home
lua-l archive

Re: How do I say a = inf in Lua?

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


On Tue, Dec 16, 2008 at 10:10 PM, Matthew Wild <mwild1@gmail.com> wrote:
> On Tue, Dec 16, 2008 at 6:47 PM, Daniel van Ham Colchete
> <daniel.colchete@gmail.com> wrote:
>> On Tue, Dec 16, 2008 at 4:18 PM, Matthew Wild <mwild1@gmail.com> wrote:

>>> http://www.lua.org/manual/5.1/manual.html#pdf-math.huge is likely what
>>> you are looking for.

>> Thank you Matthew! That answer the question really well. Thanks!

>> Thanks for the other answers too.

> It's what I love about this list so much (and Lua in fact). There are
> always so many ways to achieve something. Expect the benchmarks right
> about.... now! :)

Well, since you've asked... :-)

$ ./kbench.sh 'bench.lua infbench.lua' 1e8 2>&1 | luajit -O kbenchparse.lua
Results:
lua
-------------------------------------------------------------------
name | rel | abs s / iter = us (1e-6 s) / iter
-------------------------------------------------------------------
divide | 1.0000 | 9.30 / 100000000 = 0.093000 us
e309 | 1.0086 | 9.38 / 100000000 = 0.093800 us
huge | 1.7957 | 16.70 / 100000000 = 0.167000 us
tonumber | 5.3344 | 49.61 / 100000000 = 0.496100 us
luajit -O
-------------------------------------------------------------------
name | rel | abs s / iter = us (1e-6 s) / iter
-------------------------------------------------------------------
e309 | 1.0000 | 1.27 / 100000000 = 0.012700 us
divide | 2.0000 | 2.54 / 100000000 = 0.025400 us
huge | 2.2126 | 2.81 / 100000000 = 0.028100 us
tonumber | 22.8346 | 29.00 / 100000000 = 0.290000 us

Benchmarked code attached.

Alexander.

Attachment: infbench.lua
Description: Binary data


AltStyle によって変換されたページ (->オリジナル) /