Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-28 Thread Eric Seidel
The wiki might also note that: String bar = ASCIILiteral("foo"); is not free. :) There is still a malloc() of a StringImpl under there. On Mon, Aug 27, 2012 at 12:26 PM, Benjamin Poulain wrote: > On Sun, Aug 26, 2012 at 10:15 AM, Ojan Vafai wrote: >> >> So, is the rule something like "Use ASC

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-27 Thread Benjamin Poulain
On Sun, Aug 26, 2012 at 10:15 AM, Ojan Vafai wrote: > > So, is the rule something like "Use ASCIILiteral unless you can show > improvement on a benchmark by using ConstructFromLiteral." Could you add > some simple explanation like that to the wiki page? As someone who doesn't > understand the impl

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-26 Thread Ojan Vafai
On Fri, Aug 24, 2012 at 11:19 PM, Benjamin Poulain wrote: > On Fri, Aug 24, 2012 at 10:18 PM, Adam Barth wrote: > >> [[[ >> The difference between the version is if the length of the string is >> included or not. Having the size given in the constructor makes the >> constructor faster. Having the

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Benjamin Poulain
On Fri, Aug 24, 2012 at 10:05 PM, Adam Barth wrote: > Thanks! The wiki page is very helpful. I wonder if we should > organize a hack-a-thon to deploy this pattern throughout WebKit. Is > there a way the compiler could give us a list of all the code location > we should update? > We may discov

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Benjamin Poulain
On Fri, Aug 24, 2012 at 10:18 PM, Adam Barth wrote: > [[[ > The difference between the version is if the length of the string is > included or not. Having the size given in the constructor makes the > constructor faster. Having the size also makes the code bigger, which > is a problem when the co

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Maciej Stachowiak
On Aug 24, 2012, at 10:18 PM, Adam Barth wrote: > The wiki page says: > > [[[ > The difference between the version is if the length of the string is > included or not. Having the size given in the constructor makes the > constructor faster. Having the size also makes the code bigger, which > is

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Adam Barth
The wiki page says: [[[ The difference between the version is if the length of the string is included or not. Having the size given in the constructor makes the constructor faster. Having the size also makes the code bigger, which is a problem when the code is executed infrequently. ]]] That desc

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Maciej Stachowiak
What's the difference between the ASCIILiteral and ConstructFromLiteral versions? - Maciej On Aug 24, 2012, at 8:00 PM, Benjamin Poulain wrote: > Dear webkit-dev, > > > Some recent changes improved the way we can use string classes with literals. > > There are 3 new constructors for initi

Re: [webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Adam Barth
Thanks! The wiki page is very helpful. I wonder if we should organize a hack-a-thon to deploy this pattern throughout WebKit. Is there a way the compiler could give us a list of all the code location we should update? Adam On Fri, Aug 24, 2012 at 8:00 PM, Benjamin Poulain wrote: > Dear webki

[webkit-dev] Initializing String and AtomicString with literals

2012-08-24 Thread Benjamin Poulain
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[], ConstructFr