From cc85b927cdc1a4dad3217842215903a45044fc43 Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sat, 22 Jun 2013 00:22:08 -0400 Subject: Create a character map to use for locating stop-points in strings. In various places we were passing flags and characters to compare, then using complex conditionals to see where to stop in string searches. Performance numbers reveal that we were spending as much as 23% of our processing time in these functions, most of it in the comparison lines. Instead create a character map and use a single bitwise comparison to determine if this is any one of the stop characters. --- ChangeLog | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'ChangeLog') diff --git a/ChangeLog b/ChangeLog index ded8974..fe7cd99 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,39 @@ +2013-06-22 Paul Smith + + Improve performance by using a character map to determine where we + want to stop searching strings, rather than discrete comparisons. + + * read.c (find_char_unquote): Pass a stop map instead of various + flags and use that to check when to stop parsing the string. + (eval): Use the new find_char_unquote() calling signature. + (remove_comments): Ditto. + (unescape_char): Ditto. + (find_percent_cached): Ditto. + (parse_file_seq): Use a stop-map flag. + * main.c (stopchar_map): Character map definition. + (initialize_stopchar_map): Initialize the map definition. + (main): Invoke the map initialization function. + * misc.c (end_of_token_w32): Remove unused function. + * dir.c (dosify): Use STOP_SET to check for stop chars. + * main.c (main): Ditto. + * misc.c (end_of_token): Ditto. + * function.c (subst_expand): Ditto. + (func_notdir_suffix): Ditto. + (func_basename_dir): Ditto. + (abspath): Ditto. + * job.c (is_bourne_compatible_shell): Ditto. + * variable.c (parse_variable_definition): Ditto. + * read.c (eval): Ditto. + (conditional_line): Ditto. + (find_percent_cached): Ditto. + * dep.h (PARSE_FILE_SEQ): Update function declaration. + * default.c (set_default_suffixes): Update PARSE_FILE_SEQ() call. + * file.c (split_prereqs): Ditto. + * function.c (string_glob): Ditto. + * implicit.c (pattern_search): Ditto. + * rule.c (install_pattern_rule): Ditto. + * main.c (main): Ditto. + 2013-06-21 Paul Smith * main.c (verify_flag): Global variable to determine whether to -- cgit v1.2.3