Re: Cost of wrapping ffi functions

  • From: Mike Pall <mike-1206@xxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 6 Jun 2012 17:29:14 +0200

Tim Caswell wrote:
> I'm writing this library for the raspberry PI and was somewhat performance
> conscience (I do hope luajit works on that older arm).

It does -- I got one here. Won't take advantage of the VFP unit,
though (yet).

> Mainly I just wanted to know the best practice for wrapping ffi
> in this way.

ARM1176-JZF _does_ predict indirect branches. Also, most calls to
library functions are indirect branches on ARM, anyway. They are
usually mapped in pages far away, outside the direct branch range.

Try the example with -jdump on ARM and you'll see. I.e. don't use
dummy wrappers for C function calls -- just pass the C function
pointer.

--Mike

Other related posts: