[cfe-commits] [PATCH] Keep history of macro definitions and #undefs

Alexander Kornienko alexfh at google.com
Wed Aug 29 11:32:39 PDT 2012


I've made a quick-and-dirty performance measurement using almost all boost
1.51 headers. The test source file, script and execution logs are attached.
Clang was built with gcc (hence log names).

TL;DR: changes 'caused by the patch: preprocessor memory usage 5.9M ->7.4M,
total time: no measurable difference (both about 4.8s).

As for the test input, I consider it quite a heavy load on preprocessor:

*** Preprocessor Stats:
75165 directives found:
  19499 #define.
  4433 #undef.
  #include/#include_next/#import:
    5357 source files entered.
    27 max include stack depth
  19919 #if/#ifndef/#ifdef.
  2459 #else/#elif.
  7110 #endif.
  426 #pragma.
14996 #if/#ifndef#ifdef regions skipped
82955/459701/1316 obj/fn/builtin macros expanded, 88278 on the fast path.
129361 token paste (##) operations performed, 11361 on the fast path.

Difference between execution logs:

diff clang-gcc-perf-before-patch.log clang-gcc-perf-with-patch.log
193,194c193,194
< Preprocessor Memory: 5940151B total
<   BumpPtr: 4464640
---
> Preprocessor Memory: 7394231B total
>   BumpPtr: 5918720
229c229
< FileID scans: 205598 linear, 2102385 binary.
---
> FileID scans: 205604 linear, 2102345 binary.
239,241c239,241
< real 0m4.872s
< user 0m4.700s
< sys 0m0.160s
---
> real 0m4.796s
> user 0m4.560s
> sys 0m0.220s
434,435c434,435
< Preprocessor Memory: 5940151B total
<   BumpPtr: 4464640
---
> Preprocessor Memory: 7394231B total
>   BumpPtr: 5918720
480,482c480,482
< real 0m4.819s
< user 0m4.620s
< sys 0m0.180s
---
> real 0m4.882s
> user 0m4.730s
> sys 0m0.140s
675,676c675,676
< Preprocessor Memory: 5940151B total
<   BumpPtr: 4464640
---
> Preprocessor Memory: 7394231B total
>   BumpPtr: 5918720
711c711
< FileID scans: 205598 linear, 2102365 binary.
---
> FileID scans: 205604 linear, 2102385 binary.
721,723c721,723
< real 0m4.794s
< user 0m4.610s
< sys 0m0.170s
---
> real 0m4.789s
> user 0m4.630s
> sys 0m0.150s

-- 
Regards,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120829/f045e9b5/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test-boost.cpp
Type: text/x-c++src
Size: 3527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120829/f045e9b5/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-gcc-perf-with-patch.log
Type: application/octet-stream
Size: 26529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120829/f045e9b5/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang-gcc-perf-before-patch.log
Type: application/octet-stream
Size: 26529 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120829/f045e9b5/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: run-pp-test.sh
Type: application/x-sh
Size: 352 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120829/f045e9b5/attachment.sh>


More information about the cfe-commits mailing list