Make local var assignment faster
173 secs => 163 secs for
/repo/android.sh time kati --kati_cpuprofile=kati.prof -n
diff --git a/exec.go b/exec.go
index 798728f..977cbaa 100644
--- a/exec.go
+++ b/exec.go
@@ -292,22 +292,22 @@
localVars := vars
// automatic variables.
- localVars.Assign("@", SimpleVar{value: []byte(output), origin: "automatic"})
+ localVars["@"] = SimpleVar{value: []byte(output), origin: "automatic"}
if len(actualInputs) > 0 {
- localVars.Assign("<", SimpleVar{
+ localVars["<"] = SimpleVar{
value: []byte(actualInputs[0]),
origin: "automatic",
- })
+ }
} else {
- localVars.Assign("<", SimpleVar{
+ localVars["<"] = SimpleVar{
value: []byte{},
origin: "automatic",
- })
+ }
}
- localVars.Assign("^", SimpleVar{
+ localVars["^"] = SimpleVar{
value: []byte(strings.Join(actualInputs, " ")),
origin: "automatic",
- })
+ }
ev := newEvaluator(localVars)
ev.filename = rule.filename
ev.lineno = rule.cmdLineno