[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua string
- From: John Belmonte <john@...>
- Date: Sun, 29 Apr 2007 08:50:51 -0400
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.