[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [luarocks] lub.join is slow and probably unnecessary
- From: Thijs Schreijer <thijs@...>
- Date: Fri, 13 Jul 2018 10:31:17 +0000
Unfortunately those modules seem unmaintained now, their docs are also gone.
> On 13 Jul 2018, at 00:34, Dirk Laurie <firstname.lastname@example.org> wrote:
> I use the 'xml' luarock which depends on the 'lub' rock.
> I like it very much, but found that 'xml.dump' becomes very
> slow when the XML string is very long.
> I traced the reason to its use of the function 'lub.join'. This
> function concatenates a list by repeatedly concatenating
> the next element to the partial result, an algorithm that takes
> O(n²) time, where n is the length of the final result.
> Applications (such as 'xml') that do not need __concat
> metamethods do not need that algorithm.
> require"lub".join = table.concat
> solves all the speed problems.
> -- Dirk