What's the difference between the ASCIILiteral and ConstructFromLiteral versions?
- Maciej On Aug 24, 2012, at 8:00 PM, Benjamin Poulain <[email protected]> wrote: > Dear webkit-dev, > > > Some recent changes improved the way we can use string classes with literals. > > There are 3 new constructors for initializing a string from a literal: > -String(ASCIILIteral): > http://trac.webkit.org/browser/trunk/Source/WTF/wtf/text/WTFString.h#L139 > -String(const char[], ConstructFromLiteralTag) > -AtomicString(const char[], ConstructFromLiteralTag) > > The differences with the regular char* constructor are: > -no memory is allocated for the bytes of the string. > -the characters are not copied to the heap > -String(const char[], ConstructFromLiteralTag) does not even access the bytes > of the string. > > Those constructors are faster and use less memory in some cases. > I converted some of the generated code to use the new constructors. In the > future, please consider using ASCIILiteral() whenever constructing a String, > and ConstructFromLiteral for a AtomicString. > > cheers, > Benjamin > > PS: I started a Wiki page about the efficient use of the string classes: > http://trac.webkit.org/wiki/EfficientStrings > _______________________________________________ > webkit-dev mailing list > [email protected] > http://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-dev

