On Fri, Aug 24, 2012 at 10:18 PM, Adam Barth <[email protected]> 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 code is executed infrequently. > ]]] > > That description isn't 100% clear to me, but my reading of it is that > the ConstructFromLiteral version has the length of the string embedded > at the call site and therefore makes the code faster by increases the > code size. > Initially I thought avoiding strlen() would always be a win. In practice, I have learned the hard way that code growth can hurt us a lot on ARM so I wanted to provide a no-compromise option and added ASCIILiteral. If you use ASCIILiteral, the code does not grow a single byte. You can safely use it in any place where the default constructor was used and it always make the code faster. If you are in a place where the performance matter, or if the string is long and will not be used anytime soon, ConstructFromLiteral will give you better performance. Benjamin
_______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-dev

