From 5dfc0f6c530cd93d79bd9d18b8f61b6ce8d5e6f1 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Wed, 30 Jan 2013 23:37:35 +0000 Subject: Improve devd startup time, by tweaking some string handling routines that are heavily used when parsing config files. Mostly these changes avoid making temporary copies of the strings, and avoid doing byte at a time append operations, on the most-used code path. On a 1.2 GHz ARM processor this reduces the time to parse the config files from 13 to 6 seconds. Reviewed by: imp Approved by: cognet (mentor) --- sbin/devd/devd.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sbin/devd/devd.hh') diff --git a/sbin/devd/devd.hh b/sbin/devd/devd.hh index 36132160c475..a48d07b4930c 100644 --- a/sbin/devd/devd.hh +++ b/sbin/devd/devd.hh @@ -90,9 +90,9 @@ public: virtual bool do_match(config &); virtual bool do_action(config &) { return true; } private: + bool _inv; std::string _var; std::string _re; - bool _inv; regex_t _regex; }; @@ -162,7 +162,8 @@ public: void pop_var_table(); void set_variable(const char *var, const char *val); const std::string &get_variable(const std::string &var); - const std::string expand_string(const std::string &var); + const std::string expand_string(const char * var, + const char * prepend = NULL, const char * append = NULL); char *set_vars(char *); void find_and_execute(char); protected: -- cgit v1.3