mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-06 02:23:46 +03:00
tags: speedup: replace n^2 nub with n log n nubSort
This commit is contained in:
parent
07c4b3e0ab
commit
8cde342432
@ -7,7 +7,7 @@ module Hledger.Cli.Commands.Tags (
|
||||
)
|
||||
where
|
||||
|
||||
import Data.List
|
||||
import Data.List.Extra (nubSort)
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.IO as T
|
||||
import Safe
|
||||
@ -33,7 +33,7 @@ tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do
|
||||
q = queryFromOpts d $ ropts{query_ = unwords queryargs}
|
||||
txns = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j
|
||||
tagsorvalues =
|
||||
nub $ sort $
|
||||
nubSort $
|
||||
[if values then v else t
|
||||
| (t,v) <- concatMap transactionAllTags txns
|
||||
, maybe True (`regexMatchesCI` T.unpack t) mtagpat
|
||||
|
Loading…
Reference in New Issue
Block a user