lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Nov 06, 2001 at 10:47:08AM -0800, Chris.Kaiser@peoplefirst.com wrote:
> One good reason why, and one that I need, is to convince management
> that its a worthy solution to some dynamic code generation problems.
> 
> My boss wants me to generate compiled C++ on the fly based on the
> user communities mods. 

Okay. I presume this is for performance reasons?

> We're to build a series of tools to enable the user community to
> change the business rules on the fly. I'd like for these rules to be
> generated in lua and parsed from our C++ engine.  But I need to
> convince him that it will be fast enough.

If this is for performance reasons, then I doubt a lua dynamic
compiler will be fast enough. The "cost" of executing lua is as much
in the design of the language as a weak-typed hashtable based
scripting language as it is because it's an interpreted VM. Dynamic
compilation can get complicated and only takes care of half the
problem.

Remember the famous quote:

  Premature optimization is the root of all evil in programming. 

               ---C.A.R. Hoare
                     (often misattributed to D. E. Knuth,
                      who was himself quoting Hoare) 

If you think Lua will be fast enough, use it. However, if Lua needs a
dynamic compilation engine to be fast enough, then just render C code
during configuration, compile, link, and go.

-- 
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + jeske@chat.net