lua-users home
lua-l archive

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


On Thu 08 May, Daniel Silverstone wrote:
> 
> > > Which still does not do what you want. It is not possible to produce 2
> > > different copies of the same string in Lua.
> 
> One thing which worries me slightly is potential speed issues.
> 
> Does Lua *really* go out of its way to make sure that if I do:
> 
> a = "Hello"
> b = "World"
> 
> c = "Hello World"
> d = a .. " " .. b;
> 
> Then the storage for c and d are the same memory?
> 
> If so, then I hope there's a way to turn this off because it seems to me
> to be a hideous performance issue.

I am not an expert on this issue, but I think you are wrong.
When it comes to the Lua interpreter deciding where to store
the variable 'd' it will automatically put it in the same
place that 'c' occupies because both give the same hash. No
comparisons are involved.

-- 
Gavin Wraith (gavin@wraith.u-net.com)
Home page: http://www.wraith.u-net.com/