lua-users home
lua-l archive

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


On 14/06/2014 12:17 AM, Paige DePol wrote:
Is the "perfomance degradation" of using names (variables) instead
of constants in an if-chain similar to what it does in your switch
statement? (You may try it with different kinds of variables.)

What "performance degradation" do you mean?

I think Robert means to ask: what is the comparative performance of an if-chain vs. your switch statement implementation. And how does this comparison vary with different case types (e.g. string and number constants vs variables).


I thought we were commenting on the degradation of code
> readability by the use of "magic numbers" instead
> of symbolic constants?

That is one part of the discussion.

Another part is about potential performance benefits of having a built-in switch construct. Does it always perform better? Or only when used with constants?

Ross.