[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Can someone sell Lua 5.2.0 to me please ?
- From: Alexander Gladysh <agladysh@...>
- Date: Wed, 21 Dec 2011 19:38:28 +0400
On Wed, Dec 21, 2011 at 19:29, Joshua Jensen <firstname.lastname@example.org> wrote:
> ----- Original Message -----
> From: Alexander Gladysh
> Date: 12/21/2011 7:42 AM
>> On Wed, Dec 21, 2011 at 18:25, Joshua Jensen<email@example.com>
>>> ----- Original Message -----
>>> From: Philippe Lhoste
>>> Date: 12/21/2011 6:19 AM
>>>> On 17/12/2011 13:47, Jeff Smith wrote:
>>>>> 6) I dont like long if else blocks, so a select case construct would
>>>>> been nice IMHO.
>>>> This is usually done with a table of functions, no? A bit verbose, but
>>>> quite usable.
>>> And MUCH slower.
>> Only about 15 times slower (with vanilla Lua), AFAIR, but much more
>> In rare cases where that 15 times matter, you always can rewrite to
>> whatever is more efficient .
> I publish games. I care about performance.
Well, I'm in games too :-)
> I am willing to sacrifice some
> performance by using a scripting language,
If a piece code takes only 0.1% of execution time, you wouldn't speed
up your program more by 0.1% no matter that you do with it.
Do you really have that many if-elseif blocks so that matters?
> but when a construct can be
> created that enhances performance over the alternative, like a switch
> statement over a table of functions, I am for it.
*Language* constructs are rarely about performance only, especially in Lua.
> The Lua C source code itself uses switch in dozens of places. The result is
> plenty readable and arguably far more readable than a table of functions
> that have to be defined elsewhere in the file.
Well, I replied to the post on if-elseif vs. function tables. As for
introducing switch construct to Lua, I said all I could for in my
first letter in this thread — I *personally* do not care much for this
feature. The rest was milled over and over in the past.