lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

void= buffer.append( text_str, ... )

Ability to modify a string 'in place', without creating new entries all over. This is basically the same as "str ..=" (C-like in-place operator syntax) would be.

Usage: gathering strings together, big data. Perhaps there's a table function for this, I'll see.. (yes, 'table.concat' but I still needed to craft a temporary table to collect the strings first)

Current implementation: str= str..whatever
                    or: table.concat()

Question: does anyone know of the performance difference between 'table.concat' and regular appending?

'Programming in Lua' has a section on this..

Basically regular appending, as it currently is, in Lua is a BAD IDEA.. The old string is just 'abandoned' when you make the new, longer, string. Then the garbage collector has to come along and clean it up, which can either cause loads of memory to be 'in limbo' or cause the garbage collector to be working overtime.
Paul				VPOP3 - Internet Email Server/Gateway