lua-users home
lua-l archive

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


In mod_lua, I parse anything that's shiped to it under the name
of LuaHtml handler. A typical file would be:

<html>
<head>
<title><?lua print(titleOfPage) ?></title>
</head>

<body>
<?lua
for a=1,10 do
  ?>
  Hello, World! (for the <?lua print(a) ?>'n time<br />
  <?lua
end
?>
</body>
</html>

What my parsing code does is converts anything outside of <?lua ... ?>
to something like:

print("<html>")
print("<head>")
print("<title>")
print(titleOfPage)
print("</title>")
...etc...

Without yet doing tests, how would this parsing look if it were done
in Lua instead of C? (Speed wise)?

The parser is already written in C, however, I am going to be creating
some support programs that would be easy to write in Lua, but involve
parsing the HTML into Lua code and I wonder if it's worth, 1. writing
two parsers, or 2. writing my utilities in C and not every writing one
in Lua.

It may just come down to writing a parser and comparing the two, but
if anyone has concrete evidence that Lua will be 10x slower than C, or
something, I may not waste my time.

Thanks,

Jeremy - jc@cowgar.com
http://modlua.cowgar.com