lua-users home
lua-l archive

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




On 07/07/16 01:15 PM, Joseph Manning wrote:
On 2016-Jul-07 (Thu) at 09:08 (+0200), steve donovan wrote:

It would be cool if #t was O(1), however.
Steve,

    In theory, yes indeed, this would be nice and neat and clean.

    In practice, however, computing #t is blazingly fast.  In tests
    that I did some time ago ( Lua 5.2 ), with t being a sequence of
    10,000 elements, #t was computed 1,000,000 time in just 0.1 seconds.

    And that was on my little 2008-era netbook.

    Fast enough for me :-)

Joseph

------------------------------------------------------------------------
Joseph Manning / Computer Science / UCC Cork Ireland / manning@cs.ucc.ie
------------------------------------------------------------------------

I don't think ppl see the true power of logn.
To put it simply, I don't think ppl see that log2(10000) = 14-ish. (14 ops for 10000 elements)

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.