[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT FFI callbacks for functions using only built-in operators and locals
- From: Mike Pall <mikelu-1112@...>
- Date: Fri, 16 Dec 2011 00:01:57 +0100
Adam Strzelecki wrote:
> >> Having that such function use only built-in operators, locals
> >> and single types across whole body, could it be optimized
> >> straight ahead into machine code?
> >
> > It would be possible to reduce the marshaling overhead with a lot
> > of effort. But there's no easy way to avoid the cost for entering
> > and leaving the VM in general. And that makes up the majority of
> > the overhead.
>
> Forgive my ignorance, I may be telling here total nonsense, but
> I am just thinking about specific case where function does use
> only built in operators (that cannot be overloaded) and do not
> modify global environment.
So that would cover only something like a+b*c+1.5, provided _all_
of the variables are passed as arguments. Even a single use of an
upvalue defined outside the function would foil that approach,
because of the need for type checks (which can fail).
I don't think that's a generally useful subset of the language for
this kind of problem.
--Mike