lua-users home
lua-l archive

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


>One thing which worries me slightly is potential speed issues.

Have you seen any speed problems in Lua?

>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?

Yes. That's how strings work in Lua. The benefit is speed: string comparison is
simply a pointer comparison.

>If so, then I hope there's a way to turn this off because it seems to me
>to be a hideous performance issue.

No way to turn this off. Like I said, it's likely to help your application.
It's based in hashing.  Lua even goes out of its way to avoid reading the whole
string to hash it if the string is very long.
--lhf