[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Multiple Assignment Overhead?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 19 Sep 2012 10:00:06 -0300
> No, they generate essentially the same code, except for when the values
> are assigned to x and y:
>
> [...]
In some cases the multiple assignment can generate more instructions,
to avoid colisions:
i, a[i] = 3, 4 -- a and i local
1 [2] LOADK 2 -1 ; 3
2 [2] SETTABLE 0 1 -2 ; - 4
3 [2] MOVE 1 2
i = 3
a[i] = 4
1 [4] LOADK 1 -1 ; 3
2 [5] SETTABLE 0 1 -2 ; - 4
Nonetheless, usually those are the cases where it is worth paying the
price ;)
-- Roberto