ipfs / go-ipld-format

IPLD Node and Resolver interfaces in Go
https://github.com/ipld/ipld
MIT License
64 stars 26 forks source link

rework block decoding framework #22

Closed Stebalien closed 7 years ago

Stebalien commented 7 years ago
  1. Use an interface instead of a map so that we can define fancier block decoders.
  2. Make DefaultBlockDecoder thread safe.
Stebalien commented 7 years ago

@whyrusleeping I can also go ahead and implement an RCU now if you're concerned about speed.

Kubuxu commented 7 years ago

Acquiring ReadLock if there are no contesting writes is only matter of incrementing one atomic int so I don't think performance will suffer in this case. https://golang.org/src/sync/rwmutex.go

Stebalien commented 7 years ago

An atomic load should be an order of magnitude faster than an atomic add but that probably makes no difference in the grand scheme of things.

whyrusleeping commented 7 years ago

ship it :ship: :sheep: