convex
convex copied to clipboard
Cache recently used encodings in store
There is a potential significant performance improvement given incoming encodings:
- Keep a array of
WeakReference<ACell>inAStore - Index this by some function of
ABlob.toLong() - Use to lookup Cells already in memory if available
- Write to this array whenever a cell is stored (can overwrite safely on collisions since this is just a cache)
This should help:
- De-duplicate objects in memory
- Avoid decoding encodings if we have already done this
- Avoid hashing for repeatedly encountered encodings (e.g. incoming copies of the same orderings / blocks / transactions from multiple peers)
- Re-use the latest refs with corresponding statuses in the target cells to avoid repeated store checks / writes