What's the Difference in Speed

I’m working on the Paying Up practice problem in Lua.

My code here. Time Limit Error and an accepted solution here.

What would the main differences in speed be? They are significant.

//