lytics / CloudForest

Ensembles of decision trees in go/golang.
Other
15 stars 3 forks source link

sync CatMap to avoid concurrent map access. #23

Closed glycerine closed 5 years ago

glycerine commented 5 years ago

Add sync.Lock() and sync.Unlock() around reads and writes to the CatMap. Also add full copying of the CatMap instead of sharing. That may reduce contention.

Fixes #20

glycerine commented 5 years ago

I originally had it as Mut, but then it got confusing where the mutex was coming from -- because the CatMap is embedded in other structures the origin of the mutex was getting lost when calling in through those inheriting structs.

in densecatfeature.go:74 in particular...

https://github.com/lytics/CloudForest/pull/23/files#diff-e6bce0ff1df02a9f3541e95ad47641aeR74

timkaye11 commented 5 years ago

good point @glycerine