Re: Any LuaJIT "continue" patch?

  • From: Glenn Maynard <glenn@xxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Fri, 14 Apr 2017 14:52:30 -0500

On Fri, Apr 14, 2017 at 5:15 AM, Luke Gorrie <luke@xxxxxxxx> wrote:

I can't find a citation for this right now, sorry, but I have found LuaJIT
generating better code (bytecode) when sticking with boring "structured
programming" and avoiding things like break and return. So you might want
to take care that when introducing new control constructs you are not
taking an unwanted performance hit compared with writing things in a more
boring style.


This generates a branch, so it gives exactly the same bytecode as the
equivalent goto (break does the same thing).

(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...)

-- 
Glenn Maynard

Other related posts: