Re: Tuning numerical computations for LuaJIT (was Re: [ANN] Sci-1.0-beta1)

  • From: Geoff Leyland <geoff_leyland@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 21 Sep 2012 07:28:18 +1200

On 21/09/2012, at 12:28 AM, Mike Pall wrote:

> * Do not try to second-guess the JIT compiler.
>  - It's perfectly ok to write 'z = x[a+b] + y[a+b]'.
>    - Do not try CSE by hand, e.g. 'local c = a+b'.

Could you expand on this a little?  I asks because sometimes "hand-made CSE" 
improves readability, so:
 - Is it actually detrimental to do the above, or just pointless as a speed 
optimization?
 - Does this only apply to index expressions? (I suspect not, but all your 
examples involved indexes)
 - Does this only apply to relatively simple expressions, if so, can you say 
roughly how simple?

Geoff

Other related posts: