[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A very basic thing I don't get
- From: Javier Guerra Giraldez <javier@...>
- Date: Wed, 5 Oct 2011 16:41:44 -0500
On Wed, Oct 5, 2011 at 4:05 PM, joao lobato <btnfdp.lobato@gmail.com> wrote:
>> What is the problem with a bunch of tables?
>>
>>> Wouldn't a simple, fixed size, integer indexable (1 based, of course
>>> ;-) ), array type be better suited for the role of building block?
>>
>> If you want Fortran, you know where to find it... :-)
>> Plus Lua does very well on these arrays already...
>>
>>
>
> Well, I believe you. Not having performed any benchmarking I wouldn't
> argue about the overhead of the rest of the table implementation; it
> was just a gut feeling :-)
a case in point:
once upon a time,
(http://lua-users.org/lists/lua-l/2008-03/msg00498.html), there was a
thread where a few of us enjoyed optimizing a priority queue;
comparing a heap structure with a sorted table.
at first, a binary heap (easy to implement on an array) performed
really well; but then Gé Weijers surprised everybody with the speed of
a skew heap (that uses a tree-like structure internally).
the surprising part is that Gé's code instantiated lots of small
tables (with named fields!) to create the internal tree, but it still
was far faster than the supposedly-optimized binary heap (which used a
single integer-indexed array).
moral of the story: Lua tables are wicked fast!
--
Javier
- References:
- A very basic thing I don't get, Thijs Koerselman
- Re: A very basic thing I don't get, Peter Cawley
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Michal Kottman
- Re: A very basic thing I don't get, Stefan Reich
- Re: A very basic thing I don't get, Dirk Laurie
- Re: A very basic thing I don't get, Petite Abeille
- Re: A very basic thing I don't get, Lorenzo Donati
- Re: A very basic thing I don't get, Mark Hamburg
- Re: A very basic thing I don't get, joao lobato
- Re: A very basic thing I don't get, Luiz Henrique de Figueiredo
- Re: A very basic thing I don't get, joao lobato