AndreasSko / go-jwlm

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

Make `sortedSolutionKeys` more efficient by only running Regex once #67

Closed AndreasSko closed 3 years ago

AndreasSko commented 3 years ago

https://github.com/AndreasSko/go-jwlm/blob/8ef0ac6e572592b75a537dc260045a1932f762ee/merger/UserMarkBlockRangeMerger.go#L341 The function parses each key for every iteration of sort, so it does a lot of work multiple times. This results in the function taking almost 500ms alone! We could improve this by pulling out the number infront of the uniqueKey first, running the sort on this and later put it back together. This migth speed up the function quite a bit.