This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: add C++ alternate punctuators


>>>>> "Daniel" == Daniel Jacobowitz <drow@false.org> writes:

Daniel> Does anything performance sensitive use this lexer, or is that likely
Daniel> in the future?  I suspect this version will be quite a lot slower;
Daniel> it has a string copy and a linear search.

I don't know whether it is performance sensitive in general.
I haven't tried profiling in this area.

The string copy is already done in the not-a-keyword case.  So, if
this part of the patch negatively affects performance, then it would
only do so for the case of expressions weighted toward use of
keywords.  That doesn't seem like a scenario worth worrying about.

We already linearly search two other tables for every token, not just
keywords.  This doesn't justify adding another one, but it does
suggest that it hasn't hurt so far.

Anyway, the above was my reasoning when I wrote the patch.  Also, I
thought using a table would make it a little less error-prone to add
new keywords in the future.  (I think we are missing 7 relevant ones.)

I can rewrite it to use a hash table if you'd prefer.  Or just inline
the new keywords into the switch and delete the comment.  Let me know.

Tom


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