diff options
author | Josh Stone <jistone@redhat.com> | 2009-07-09 12:43:00 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-07-09 16:17:14 -0700 |
commit | 66c7d4c1a4147bc05abd1e69f41ec9d59685c433 (patch) | |
tree | 73f601be5d41f897fafff9e94f3b51c4359af78c /parse.h | |
parent | c145b9cb053a1275865302d23fb3072143534fc8 (diff) | |
download | systemtap-steved-66c7d4c1a4147bc05abd1e69f41ec9d59685c433.tar.gz systemtap-steved-66c7d4c1a4147bc05abd1e69f41ec9d59685c433.tar.xz systemtap-steved-66c7d4c1a4147bc05abd1e69f41ec9d59685c433.zip |
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.
Diffstat (limited to 'parse.h')
-rw-r--r-- | parse.h | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -15,6 +15,7 @@ #include <fstream> #include <iostream> #include <vector> +#include <set> #include <stdexcept> #include <stdint.h> @@ -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<std::string> keywords; }; struct probe; |