Re: Array performance with 2.0.0-beta10 versus git HEAD

  • From: Mike Pall <mike-1208@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Tue, 28 Aug 2012 19:27:36 +0200

Peter Colberg wrote:
> Why is there such a significant difference with 2.0.0-beta10, and not
> with git HEAD? Could this actually be caused by the absolute versus
> relative script path?

Trace selection is probabilistic and memory layout influences the
algorithm. The key problem is the innermost loop with a low, but
non-constant iteration count (from the compilers perspective).
Sometimes it gets unrolled, sometimes not, depending on what's
compiled first.

Anyway, I'm sure there are plenty of examples for FFI vector and
array classes out there, that don't suffer from this problem. E.g.
properly unrolled arithmetic metamethods, no 1-based indexing,
structs instead of tables as wrappers, bounds checks dynamically
compiled only for debugging, etc.

> I built LuaJIT on a current Debian wheezy (x86_64) using
>
> make amalg "CFLAGS=-fPIC -DLUAJIT_ENABLE_LUA52COMPAT -DLUAJIT_CPU_SSE2"

On x64, -DLUAJIT_CPU_SSE2 is pointless. And -fPIC is not useful.
The shared library is compiled with -fPIC, anyway.

--Mike

Other related posts: