From 66c7d4c1a4147bc05abd1e69f41ec9d59685c433 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 9 Jul 2009 12:43:00 -0700 Subject: Optimize string usage in the lexer This speeds up the parsing stage >2x, mostly by minimizing string construction and comparison where char comparison will do. --- parse.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'parse.h') diff --git a/parse.h b/parse.h index 59046bf3..4cc4f7b2 100644 --- a/parse.h +++ b/parse.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -78,19 +79,19 @@ public: void set_current_file (stapfile* f); private: - int input_get (); - void input_put (int); + inline int input_get (); + inline int input_peek (unsigned n=0); void input_put (const std::string&); - int input_peek (unsigned n=0); - std::istream& input; std::string input_name; std::string input_contents; - int input_pointer; // index into input_contents + const char *input_pointer; // index into input_contents + const char *input_end; unsigned cursor_suspend_count; unsigned cursor_line; unsigned cursor_column; systemtap_session& session; stapfile* current_file; + static std::set keywords; }; struct probe; -- cgit