x = x .. "\n"
, the garbage collector will eventually run and collect this string. When you're concatenating large strings together over and over again (like in a loop) that will add up quickly and force the garbage collector to run and will slow down code by a lot the larger those strings are.table.concat
on it:f
will perform faster than f_2
because both functions used are saved in a local variable rather than getting retrieved from _G
, which saves time over a long period of time.