Thank you for the fast response. By a process of just reverting files between the two versions I have pinpointed exactly what is going wrong. Not really sure why it is bad for me and not anyone else? The change is in lj_mcode.c, /* Target an address in the static assembler code (64K aligned). ** Try addresses within a distance of target-range/2+1MB..target+range/2-1MB. ** Use half the jump range so every address in the range can reach any other. */ #if LJ_TARGET_MIPS /* Use the middle of the 256MB-aligned region. */ uintptr_t target = ((uintptr_t)(void *)lj_vm_exit_handler & 0xf0000000u) + 0x08000000u; #else uintptr_t target = (uintptr_t)(void *)lj_vm_exit_handler & ~(uintptr_t)0xffff; #endif const uintptr_t range = (1u << (LJ_TARGET_JUMPRANGE-1)) - (1u << 21); On Wed, Sep 4, 2013 at 6:47 PM, Mike Pall <mike-1309@xxxxxxxxxx> wrote: > Kriss@xxxxxxxx wrote: > > I seem to be experiencing a huge lua speed drop when using LuaJIT-2.0.2 > on > > android, code that was previously clocking in at around 5ms now take > 100ms > > > > Dropping back to LuaJIT-2.0.1 fixes the problem. > > > > Running LuaJIT-2.0.2 with "jit.off()" fixes the problem. > > That's rather strange ... > > > So it does seem to be something to do with a change in the JIT code. > > Here's the only possibly relevant change between 2.0.1 and 2.0.2: > > commit 3e286c1e72651f91a2f4ca5b1fa2f366ac4cd0fa > Date: Thu Feb 28 17:51:16 2013 +0100 > > ARM: Fix cache flush/sync for exit stubs of JIT-compiled code. > > diff --git a/src/lj_asm_arm.h b/src/lj_asm_arm.h > index afb1054..196f797 100644 > --- a/src/lj_asm_arm.h > +++ b/src/lj_asm_arm.h > @@ -91,6 +91,7 @@ static MCode *asm_exitstub_gen(ASMState *as, ExitNo > group) > *mxp++ = group*EXITSTUBS_PER_GROUP; > for (i = 0; i < EXITSTUBS_PER_GROUP; i++) > *mxp++ = ARMI_B|((-6-i)&0x00ffffffu); > + lj_mcode_sync(as->mcbot, mxp); > lj_mcode_commitbot(as->J, mxp); > as->mcbot = mxp; > as->mclim = as->mcbot + MCLIM_REDZONE; > > Try to remove the lj_mcode_sync line from 2.0.2, rebuild and test > again. If it goes away, we'll have to investigate further. Because > the sync is really needed as it was added due to a (rare) crash. > > OTOH, if this is really the problem, then it would indicate your > code is generating traces at a very high rate. Which means you > should look at the output of -jv or the equivalent: > > require("jit.v").start("/sdcard/wherever/my_dump.txt") > > For this to work you'll need to install or bundle src/jit/v.lua > and src/jit/vmdef.lua. > > > This also seems to be something to do specifically with Android rather > than > > ARM, I'm also running luajit on the Raspberry Pi (although built with > > different flags) and not experiencing the same problem. > > > > Currently testing primarily on a Nexus7. > > The RPi is an ARMv6 with a tiny cache, where too frequent cache > flushes would have little consequences. The Nexus 7 (2012) is a > quad-core Cortex-A9 which might be rather sensitive to that. > > > This is part of a reasonably large project and it is of course possibly I > > have some other strangeness somewhere that is triggering the problem. > Still > > the moving from 2.0.1 to 2.0.2 is my biggest clue on where the problem is > > so I'm hoping to try and work out exactly what that change was. > > If the above change isn't the culprit, you could do a git bisect > until you find the commit that triggers it. A bit tricky to use > that for a large project, though. > > --Mike > > -- Kriss http://www.WetGenes.com/