This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Speed up _cpp_clean_line and _cpp_skip_block_comment
- From: Mike Stump <mrs at apple dot com>
- To: Neil Booth <neil at daikokuya dot co dot uk>
- Cc: Zack Weinberg <zack at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Oct 2003 11:01:01 -0700
- Subject: Re: Speed up _cpp_clean_line and _cpp_skip_block_comment
On Monday, October 13, 2003, at 10:54 PM, Neil Booth wrote:
Zack Weinberg wrote:-
This patch does a bit of hand tuning on two hot spots in cpplex.c.
_cpp_skip_block_comment is just changed to use a local pointer - gcc
A lot of cpplex.c can benefit from this, albeit less noticably since
comments are a big % of the file.
through cc1 -P -E. According to kcachegrind:
before after
change %
_cpp_clean_line
instructions 2 210 404 682 1 801 726 448 -399 678
234 18
memory reads 516 097 743 240 090 189 -276 007
554 53
memory writes 161 268 766 25 054 442 -136 214
334 84
_cpp_skip_block_comment
instructions 758 363 288 589 357 957 -169 005
331 22
memory reads 107 773 080 107 773 080
0 0
memory writes 105 088 372 19 690 732 - 85 397
640 81
What do these numbers mean? I can guess the first column only.
Decryption key:
s/\([0-9]\) \([0-9]\)/\1\2/g
gives:
before after change %
_cpp_clean_line
instructions 2210404682 1801726448 -399678234 18
memory reads 516097743 240090189 -276007554 53
memory writes 161268766 25054442 -136214334 84
_cpp_skip_block_comment
instructions 758363288 589357957 -169005331 22
memory reads 107773080 107773080 0 0
memory writes 105088372 19690732 -85397640 81
From there, we just have before and after counts of the number of
operations in the first column, and the absolute change and change
expressed as a % improvement. 80% less writes, 20% less instructions,
and in the case of clean, 50% less memory reads.
I take it you didn't take a Cobol class that covered pic in detail. :-)