AndreasSko / go-jwlm

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

⚡ Two small performance improvements #74

Closed AndreasSko closed 3 years ago

AndreasSko commented 3 years ago

⚡ Grow strings.Builder at beginning

This should reduce the number of growSlice operations resulting in some minor speedups. The number was determined by looking at the average size of keys.

⚡ More efficient Regex umbr.Equals

Instead of doing replace, a FindStringSubmatch is actually all that's needed. It is just a minor change, but still reduces the runtime by a few tens of milliseconds.

See #47 for a similar improvement.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.009%) to 86.327% when pulling a5ae6e80c3acb7c7cad07ba79bf8e58d6ece9386 on small_perf_improvements into 66622c88f54b317dbbf885c13b4ce643398ad77b on master.