lua-users home
lua-l archive

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

David Given wrote:
> Having a quick shufty through the source code reveals that SpiderMonkey
> distinguishes between mutable and immutable strings. Mutable strings can have
> a preallocated buffer.
> So what's probably going on here is that the concatenation is mostly being
> done as a data copy, with no extra allocations needed. A neat trick.
> Lua could do something similar, but this would require a rather more
> complicated compiler and garbage collector, to intelligently decide whether to
> use mutable or immutable strings...

Yes, and consider that it's the complexity of SpiderMonkey which makes
it intolerably slow, have a hideous C API, and be (historically) bug-ridden.