feat: optimize runtime (2x+ faster)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Slot indices follow declaration order, not first-use order.
|
||||
uint first = 1;
|
||||
uint second = 2;
|
||||
second = second + 1;
|
||||
first = first + second;
|
||||
if (first != 4)
|
||||
exit(1);
|
||||
|
||||
// Shadowed locals use distinct slots in distinct environments.
|
||||
uint value = 10;
|
||||
{
|
||||
uint value = 20;
|
||||
value = value + 1;
|
||||
if (value != 21)
|
||||
exit(1);
|
||||
}
|
||||
if (value != 10)
|
||||
exit(1);
|
||||
|
||||
// Access an outer local from nested loop/body scopes.
|
||||
uint total = 0;
|
||||
for (uint i = 0; i < 4; i = i + 1)
|
||||
{
|
||||
{
|
||||
uint nested = i;
|
||||
total = total + nested;
|
||||
}
|
||||
}
|
||||
if (total != 6)
|
||||
exit(1);
|
||||
Reference in New Issue
Block a user