AndreasSko / go-jwlm

A command line tool to easily merge JW Library backups, written in Go.
MIT License
74 stars 4 forks source link

:zap: Don't compile Regex multiple times #72

Closed AndreasSko closed 3 years ago

AndreasSko commented 3 years ago

Especially for comparing UMBRs, the Regex was compiled thousands of times, resulting in 120ms of regexp.MustCompile when merging my personal backup (25k markings).

By taking this out of the function, it only needs to run once.

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-0.01%) to 86.19% when pulling ec0435faac38b15d218b8a75202b5dc120e3de95 on umbr_regex_out into 60317dfa6f461c212628f815d9f55b8a7b1eec73 on master.