[cfe-commits] [PATCH] Optimize NumericLiteralParser::GetIntegerValue()

Dmitri Gribenko gribozavr at gmail.com
Tue Sep 25 11:28:53 PDT 2012


Hello,

NumericLiteralParser::GetIntegerValue() does a conservative estimate
on the size of numbers that can fit into uint64_t.  This bound can be
improved.  See the attached patch.

I see a 0.240s -> 0.160s reduction on -fsyntax-only time in a Release
clang build on a source file generated by the following python script:

for i in xrange(0, 2000):
    print "void func{0}() {{".format(i)
    for j in xrange(0, 100):
      print "123456789012345678;"
    print "}"

Please review.  I know that this patch sort-of falls into the
"obvious" bucket, but I wanted to make sure that this patch is
appropriate.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: optimize-NumericLiteralParser-GetIntegerValue-v1.patch
Type: application/octet-stream
Size: 2152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120925/36e271d3/attachment.obj>


More information about the cfe-commits mailing list