The performance is different, the second method is more efficient.
Internally, a Lua table contains an array part and a hash part, if the table is a sequence, then the sequence part is implemented by the array part. But the table in your second example is not a sequence, it's probably implemented by the hash part. The performance in this case is not like accessing arrays in C/C++, but like accessing a hash, which is still pretty fast.
So in conclusion, the second piece of code is faster, because it doesn't iterate through the elements like in your first example.