[PATCH] Reduce GC overhead of the C++ lexer buffer
Richard Guenther
rguenther@suse.de
Mon Jun 19 12:29:00 GMT 2006
At the moment we have
cp/parser.c:292 (cp_lexer_new_main) 0: 0.0% 82369152:33.3% 0: 0.0%
15784576:37.2% 7
which is due to the fact that the initial lexer buffer size is no where
near a power-of-two value and we keep gc-reallocating the vector, doubling
its size.
With the following patch, this overhead is removed nearly completely
cp/parser.c:266 (cp_lexer_new_main) 0: 0.0%
36: 0.0% 0: 0.0% 4: 0.0% 1
Comments?
Thanks,
Richard.
2006-06-19 Richard Guenther <rguenther@suse.de>
* parser.c (CP_LEXER_BUFFER_SIZE): Adjust to assure near
power-of-two token vector size.
Index: cp/parser.c
===================================================================
*** cp/parser.c (revision 114767)
--- cp/parser.c (working copy)
*************** static void cp_parser_initial_pragma
*** 205,211 ****
(cp_token *);
/* Manifest constants. */
! #define CP_LEXER_BUFFER_SIZE 10000
#define CP_SAVED_TOKEN_STACK 5
/* A token type for keywords, as opposed to ordinary identifiers. */
--- 205,211 ----
(cp_token *);
/* Manifest constants. */
! #define CP_LEXER_BUFFER_SIZE (262144/sizeof(cp_token))
#define CP_SAVED_TOKEN_STACK 5
/* A token type for keywords, as opposed to ordinary identifiers. */
More information about the Gcc-patches
mailing list