[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The meaning of 'sugar' [Forked from Re: Why do we have ipairs?]
- From: Ross Bencina <rossb-lists@...>
- Date: Sat, 14 Jun 2014 00:40:37 +1000
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?