use pattern for outputPatterns
outputPatterns should be <prefix>%<suffix>.
It is waste to find % in every time.
parse outputPattern as pattern (<prefix>, <suffix>) and use it.
before:
repo/android.sh kati -c # with cpuprofile
82.04s
canPickImplicitRule 27.17s (34.34%)
matchPattern 19.11s (23.29%) out of the above
strings.IndexByte 16.96s (20.67%) out of the above
after:
repo/android.sh kati -c # with cpuprofile
64.04s
canPickImplicitRule 8.08s (12.62%)
pattern.match 3.45s (5.39%)
diff --git a/rule_parser_test.go b/rule_parser_test.go
index b685f3d..de49082 100644
--- a/rule_parser_test.go
+++ b/rule_parser_test.go
@@ -41,7 +41,7 @@
{
in: "%.o: %.c",
want: Rule{
- outputPatterns: []string{"%.o"},
+ outputPatterns: []pattern{pattern{suffix: ".o"}},
inputs: []string{"%.c"},
},
},
@@ -53,7 +53,7 @@
in: "foo.o: %.o: %.c %.h",
want: Rule{
outputs: []string{"foo.o"},
- outputPatterns: []string{"%.o"},
+ outputPatterns: []pattern{pattern{suffix: ".o"}},
inputs: []string{"%.c", "%.h"},
},
},
@@ -117,7 +117,7 @@
{
in: "%.o: CFLAGS := -g",
want: Rule{
- outputPatterns: []string{"%.o"},
+ outputPatterns: []pattern{pattern{suffix: ".o"}},
},
assign: &AssignAST{
lhs: "CFLAGS",