Re: Any LuaJIT "continue" patch?

  • From: Glenn Maynard <glenn@xxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sat, 15 Apr 2017 00:27:43 -0500

On Sat, Apr 15, 2017 at 12:03 AM, Luke Gorrie <luke@xxxxxxxx> wrote:


My word of caution here is that I believe 'break' and 'goto' do cause the
bytecode compiler to produce surprisingly sub-optimal code, in practice
today with the standard software version, and so your 'continue' mechanism
may encounter these same problems. (I apologize for not showing a test case
-- I don't have one handy and don't recall the exact details.)


I'm implementing this to compare GC performance with our code (runtime
performance is nice, but a side benefit), and I have lots of existing code
using continue.  As long as it's not so catastrophic that it's slower than
interpreted Lua (that would make me worried about using it at all), it's
not much of an issue to me.




(Avoiding fundamental control flow like break, return and continue isn't
"boring", it's just bad code.  I've had to untangle way too much twisted
code from people who apparently heard from a professor 25 years ago never
to use return in the middle of a function...)


That may be a satisfying argument to have with Dijkstra's ghost but I
don't think you will persuade the bytecode compiler with rhetoric... :-)


If a script is so slow that people start changing continues into a bunch of
nested conditionals to try to trick the compiler into generating faster
code, it's about time to move that logic to native rather than mangling Lua.

-- 
Glenn Maynard

Other related posts: