lua-users home
lua-l archive

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



If this kind of performance gains (magnitude 10%!) are easily gained, even if they're platform specific, I would like them to be used out of the box. :) The reason? People will be comparing Lua with other scripting languages (s.a. Python) in real world situations, and most likely using x86 platforms doing that.

-ak

25.9.2004 kello 19:03, Mike Pall kirjoitti:

 Hi,

Following up to myself:
  A combined inline assembler replacement may speed up the code quite
a bit. Anyone know what the fastest way to determine whether a double
  fits into an int is on x86?

Well, it's simpler than I thought: the FPU already stores overflow and
precision loss bits in the status word. You just have to check them after
the fistpl instruction.

                -O     -O2    -O3 -fomit-frame-pointer
lua-5.0.2       3.30   3.40   3.60
lua-5.1-work0   3.72   4.30   3.44
lua-5.1-work2   4.03   4.18   3.50

Trying the same tests with the appended patch:

lua-5.1-work2a    3.82   4.07   3.28

Looks better now.

There are plenty more optimization opportunities in ltable.c and lvm.c,
but I'll leave that to someone with an immediate need. Dito for the
conversion of the GCC assembler macros to MSVC syntax.

Bye,
     Mike
<getnum.patch>