Optimze perfomance

@dave, not David :slight_smile:

To use the progress bar:
1/ fps:progressBarInit(“some title”) in the setup() or anywhere.
2/ fps:progressBarUpdate(x) with x between 0 and 1 when you want to update the bar.
That’s it. The bar disappears when x is 0 or 1.

@mpilgren You’re absolutely right. I wrote a similar little bit of code, ran it through 10 iterations, and was all prepared to show how the local def consistently outperformed the non-predefined example.

Then I ran it 100x more, and my “improvement” vanished into a pool of coincidence.

.@Mark @mpligrem The two js are distinct:

do
local j = 10
for j = 1,2 do
print(j)
end
print(j)
end

Produces:

1
2
10

So the loop variable is always a new variable local to the loop and initialising it outside the loop simply creates a new variable outside the loop (which is then hidden inside it).