lua-users home
lua-l archive

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

On Mon, Nov 8, 2010 at 11:28 AM, Luiz Henrique de Figueiredo
<> wrote:

> Reading the file in blocks is fine in Lua if the block size is large enough.
> I tried several block sizes with my lmd5 with an added function that does
> the whole thing in C (with BUFSIZ blocks). The times reported are computed
> with os.clock. The input was a 40Mb file. Of course, doing it in C has the
> advantage of not generating garbage in Lua, but that did not seem to make
> much difference. The machine I used had BUFSIZ equal to 8192; note how
> similar the time is for that block size compared with the C time.
Hi Luiz,

Could you tell us how many available memory had this machine? This
will affect how often the garbage collector must be activated.

Another point is that: with standard Lua, to read 64KB with BUFSIZ of
8192 do not require additional concats because 10 x 8KB = 80KB. Could
you run the code with 256KB, 1MB, 16MB and 32MB buffers? This will
generate additional concats and depending on the amount of available
memory, some garbage collection.

Note that compiling Lua for Windows with MS compilers could be
complicated because BUFSIZ is only 512.