currency: boost retrieval speed when calling currency.NewCode() (#1014)

* currency: optimization pass

* currency: reimplement and fix tests and run benchmark comparison

* Update currency/code_test.go

Co-authored-by: Scott <gloriousCode@users.noreply.github.com>

* glorious: nits

* glorious: nits

Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io>
Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
Ryan O'Hara-Reid
2022-08-31 10:45:45 +10:00
committed by GitHub
parent 42291fbbfe
commit 7b958d2c05
4 changed files with 225 additions and 135 deletions

View File

@@ -28,7 +28,7 @@ type Role uint8
// BaseCodes defines a basket of bare currency codes
type BaseCodes struct {
Items []*Item
Items map[string][]*Item
LastMainUpdate time.Time
mtx sync.Mutex
}