Precompile regex
dim opened this issue · comments
Dimitrij Denissenko commented
Instead of compiling the regular expressions on each cycle, you should precompile them for improved performance, i.e.:
Instead of:
reg, _ := regexp.Compile("^rv:(.+)$")
You should declare a global and reusable:
var rvReg = regexp.MustCompile("^rv:(.+)$")
Miquel Sabaté Solà commented
@dim Thanks for the suggestion :)