Re: best practice

  • From: Javier Guerra Giraldez <javier@xxxxxxxxxxx>
  • To: LuaJIT <luajit@xxxxxxxxxxxxx>
  • Date: Fri, 26 Jun 2015 02:18:49 -0500

On Fri, Jun 26, 2015 at 1:37 AM, Laurent Deniau <Laurent.Deniau@xxxxxxx> wrote:

Micro benchmarks show that the performances are the same for all cases


always be suspicious of "same" benchmarks. often that means you're
benchmarking some other thing, and your target is either optimized
away, or lost in the noise.

with LuaJIT, be sure to call your code many times, (many thousands, at
least) with no non-compiled code in the loop. test with the profiler,
to see that your loop stays "100% compiled"

avoid feeding constants to your function, and don't discard results.
if you do, your tests could be optimized to unreal cases. sometimes
the easiest thing is to feed back results as input to the next
iteration.

most of your code deals with input types, so be sure to try with all
the input types you care about: floats, integers, long long
integers...

--
Javier

Other related posts: