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. --- file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index b392ace..284e19a 100644 --- a/file.c +++ b/file.c @@ -430,7 +430,7 @@ remove_intermediates (int sig) struct dep * split_prereqs (char *p) { - struct dep *new = PARSE_FILE_SEQ (&p, struct dep, '|', NULL, 0); + struct dep *new = PARSE_FILE_SEQ (&p, struct dep, MAP_PIPE, NULL, 0); if (*p) { @@ -439,7 +439,7 @@ split_prereqs (char *p) struct dep *ood; ++p; - ood = PARSE_FILE_SEQ (&p, struct dep, '\0', NULL, 0); + ood = PARSE_FILE_SEQ (&p, struct dep, MAP_NUL, NULL, 0); if (! new) new = ood; -- cgit v1.2.3