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 unnecessarily repeat regex in sorting #69

Closed AndreasSko closed 3 years ago

AndreasSko commented 3 years ago

The regex to extract the number would run on every iteration of sort, which resulted in almost 500ms of just regex computations in some cases.

This introduces an anonymous struct that stores the number and its key. By this we can run regex once and later sort according to the number in the struct.

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.1%) to 86.204% when pulling 65f10b144606a6a69f18270df9c13c345834c188 on efficient_umbr_sort into 8ef0ac6e572592b75a537dc260045a1932f762ee on master.

AndreasSko commented 3 years ago

Closes https://github.com/AndreasSko/go-jwlm/issues/67