This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: better cpplex.c patch


Greg McGary wrote:-

> Zack, what's the rationale for tokenlists allocating from a single
> buffer?  Does this save significant time because you can free a token
> list all at once?  Is the savings still enough when you account for
> the cost of realloc'ing and relocating token pointers?

Hi Greg,

The rationale is that the token list is re-used for each (logical)
line of the input file.  In 90% of cases I doubt the list ever gets
realloced, as it is fairly wide initially, and in the remaining 10% it
probably gets realloced no more than once or twice.  So I do believe
it saves considerable time.

I intend to rework the lexer in the near future, and token lists with
attached buffers like this will probably go away.

Neil.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]