lua-users home
lua-l archive

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

on 1/31/08 12:11 PM, Mike Pall at wrote:

> Mark Hamburg wrote:
>> on 1/31/08 11:02 AM, Eric Tetz at wrote:
>>> It's certainly no burden to *type*, but I think most programmers
>>> find it unappealing to incur a performance penalty for the sake
>>> of source beautification. If you've got 50 lines, Lua's creating
>>> 48 strings of intermediate garbage just to concatenate them,
>>> right?
>> That's why we need constant folding in the compiler so that the compiled
>> code only has one string.
> Ok, let the parser concatenate the string. How is that better
> than doing it at runtime? Most of these are used at the module
> top-level and this runs only once.

I'll buy that argument. My point was mostly that if the performance is a
concern, then the place to fix this is not by changing the lexer but to
introduce constant folding into the compiler for this operation.