lua-users home
lua-l archive

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

Matthew Wild wrote:
> Out of curiosity, does anyone have a technical explanation to offer
> for why Lua performs up to 30x worse than Python and Perl in the
> pidigits benchmark?

This benchmark is almost meaningless for comparing languages
because it spends most of the time in GMP (for those programs that
use it, i.e. almost all of them).

One of the Lua programs does all the arithmetic in Lua itself.
Obviously it's hard to beat GMP which is written in hand-optimized
assembler. The other Lua program uses a rather naive GMP binding.

I'm sure if all languages were to implement the multi-precision
arithmetic natively then Lua would be quite competitive.

Linker wrote:
> I think that is  because of it used  a dynamically compiled chunk.
> The loadstring() function is not a fast funtion.

Wrong. The factory function is only used a total of 4 times.