[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: When do we get benefit to use "long string"?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 21 Jun 2016 09:56:26 -0300
> Satoru Kawahara <s1311350@coins.tsukuba.ac.jp>于2016年6月21日周二 下午4:31写道:
>
> > > 2016-06-21 8:33 GMT+02:00 Satoru Kawahara <s1311350@coins.tsukuba.ac.jp
> >> >:
> >> > That kiind of long string is a Pascal construct. "long string" in Lua
> >> means
> >> > a string delimited by [[...]] etc.
> >>
> >> Which will have exactly the same representation as any other string,
> >> depending on the 255 char limit.
> >>
> >>
> > Huh, it doesn't enhance the performance? thank you.
> >
> >
> It's not about performance.
It is also not about [[...]] (nor about 255 char limit...). Lua
represents strings in two different ways. Strings shorter than (or equal
to) 40 bytes are internalized; longer strings are not. These longer
strings are what are called "long strings" internally. They have nothing
to do with the [[...]] syntax, which are called a "long literal".
(BTW, although they were not implemented for performance, they seem
to improve performance in programs that create lots of long strings.)
-- Roberto