cadence
cadence copied to clipboard
memory metering for codec
I included metering for newly allocated Cadence values and types on decoding but there may be gaps. My biggest concern is that there may be unbounded values that are metered after allocation.
We may also want to meter the encoded bytes. Reasons not to include:
- It's smaller than the already-metered cadence Values and Types it represents.
- There's a fair amount of overhead in metering. That being said, there's an advantage: the default io.Writer the Encoder uses is a wrapper that keeps track of the number of encoded bytes, making it fairly easy to add metering every e.g. 1000 bytes.